<?php require_once '../classes/connection.class.php'; require_once '../classes/dish.class.php'; require_once '../classes/locate.class.php'; if (isset($_POST['submit'])) { $dish_id = $_POST['dish_id']; $dish_title = $_POST['title']; $dish_price = $_POST['price']; } $updatedishObject = new Dish(); $updatedishObject->setdishID($dish_id); $updatedishObject->setdishTitle($dish_title); $updatedishObject->setdishprice($dish_price); $flag = $updatedishObject->updatedish(); // echo '<pre>'; // print_r($flag); // echo '</pre>'; // exit; if ($flag) { $_SESSION['dish_updated'] = $err = "The dish has been updated successfully"; new Locate('../index.php?page=dish&action=view'); } else { $_SESSION['dish_not_updated'] = $err = "The dish couldn't be updated"; new Locate('../index.php?page=dish&action=view'); }
<?php session_start(); require_once '../classes/connection.class.php'; require_once '../classes/dish.class.php'; $adddishobj = new Dish(); /*echo '<pre>'; print_r($adddishobj); echo '</pre>'; exit; */ $dish_id = mysqli_real_escape_string($adddishobj->conxn, $_POST['dish_id']); $dish_title = mysqli_real_escape_string($adddishobj->conxn, $_POST['title']); $dish_price = mysqli_real_escape_string($adddishobj->conxn, $_POST['price']); $adddishobj->setdishID($dish_id); $adddishobj->setdishTitle($dish_title); $adddishobj->setdishprice($dish_price); //$adduserobj->setError($er); //$adduserobj->setMessage($msg); $adddishobj->adddish(); /*echo '<pre>'; print_r ($adduserobj); echo '</pre>'; exit;*/ if ($adddishobj) { header('location:../index.php?page=dish&action=view'); $_SESSION['msg'] = $adddishobj->msg = "The dish has been added sucessfully"; } else { echo $_SESSION['msg'] = $adddishobj->msg = "Sorry the dish has not been added, please try again later"; }