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();
?>