$uploadsDirecotry = "resources/uploads/"; $maxSize = 4000000; $upload = new Upload($file, $allowedExts, $uploadsDirecotry, $maxSize); $upload->uploadFiles(); $editPage['page_image'] = $uploadsDirecotry . $upload->getFileUrl(); } catch (Exception $exc) { $exc->getMessage(); } } else { $editPage['page_image'] = 'resources/images/logo.png'; } $tabename = "pages"; $id = $_GET['id']; try { $updatePage = new Update($editPage, $tabename); $updatedPage = $updatePage->editData($id); if ($updatedPage) { echo '<script type="text/javascript"> alert("The New Page was updated !"); history.back();</script>'; } } catch (Exception $exc) { echo $exc->getMessage(); } } } } else { $tablename = "pages"; $displaypages = new Display($tablename); $PagesDataDisplay = $displaypages->getAllData(); for ($i = 0; $i < count($PagesDataDisplay); $i++) { $id = $PagesDataDisplay[$i]['sectionId']; $display = new Display('sections');
// Edit: if (isset($_GET['action']) and $_GET['action'] == "edit") { $id = $_GET['id']; $tablename = "sections"; $editSecDis = new Display($tablename); $recSecdata = $editSecDis->getRecordByID($id); include 'veiws/editSection.php'; } if (isset($_POST['submit']) && $_POST['submit'] == "Edit") { //sections: id, sectionName, sectionStaus, sectionLocation, sectionDesc, sectionDate, username $SecDataedit['sectionName'] = $_POST['sectionName']; $SecDataedit['sectionStaus'] = $_POST['sectionStaus']; $SecDataedit['sectionLocation'] = $_POST['sectionLocation']; $SecDataedit['sectionDesc'] = $_POST['sectionDesc']; try { $tablename = "sections"; $SecUpdate = new Update($SecDataedit, $tablename); $updtSec = $SecUpdate->editData($id); if ($updtSec) { echo '<script type="text/javascript"> alert("The Section was updated !"); history.back();</script>'; } } catch (Exception $exc) { echo $exc->getMessage(); } } } else { $tablename = "sections"; $displaySec = new Display($tablename); $SecDataDisplay = $displaySec->getAllData(); include 'veiws/sections.php'; }