php not well formed?

Posted by Idealflip on Stack Overflow See other posts from Stack Overflow or by Idealflip
Published on 2010-05-18T02:13:48Z Indexed on 2010/05/18 2:20 UTC
Read the original article Hit count: 239

Filed under:
|

Hi Everyone, when my site loads, it stops half way because of specific php code. When I try commenting out the php code, the whole page loads properly (input boxes, buttons etc.)

This is the code that causes the issue

<?php
        //if the add location button is clicked, the add location, the whole form will not be submitted
            if($_REQUEST['command'] == 'Add'){
                if($_POST['companyLocation'] == ""){
                    $errmsg="Please enter a location1";
                }
                elseif($_POST['companySize'] == ""){
                    $errmsg="Please enter a size for the location";
                }
                else{
                    $location = Location::instance();

                    $testing = $location->doesExist($_POST['companyLocation']);
                    if ($testing == true){
                        $errmsg="Location already exists";
                    }
                    else{
                        $objLocation = new Obj_Location();
                        $objLocation->set_Name($_POST['companyLocation']);
                        $objLocation->set_Size($_POST['companySize']);
                        $location->addLocation($objLocation);
                        $location->saveInstance();
                    }
                }
            }

//this is the part that breaks! when I comment it out, the page loads properly.
        $location = Location::instance();
        $location->deleteItem($_GET["item"]);
        $location->saveInstance();
        $location->listItems();
        ?>

© Stack Overflow or respective owner

Related posts about php

Related posts about XHTML