Exemplo n.º 1
0
<?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');
}
Exemplo n.º 2
0
<?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";
}
Exemplo n.º 3
0
<?php

//require_once('../bootstrap.php');
//session_start();
require_once 'classes/connection.class.php';
require_once 'classes/dish.class.php';
require_once 'classes/locate.class.php';
$dish_id = isset($_GET['dish_id']) ? $_GET['dish_id'] : '';
$objdelete = new Dish();
$objdelete->setdishID($dish_id);
$flag = $objdelete->deletedish();
/*echo $objdelete->sql;
exit;*/
/*echo '<pre>';
print_r($flag);
echo'</pre>';
exit;*/
if ($flag) {
    //echo "post already deleted";
    new Locate('index.php?page=dish&action=view');
    $_SESSION['msg'] = $objdelete->msg = "dish deleted sucessfully";
} else {
    header('location:../index.php?page=dish&action=view&err=dishnotdeleted');
}
Exemplo n.º 4
0
<?php

include 'classes/connection.class.php';
include 'classes/dish.class.php';
$dish_id = isset($_GET['dish_id']) ? (int) $_GET['dish_id'] : '';
$objdish = new Dish();
$objdish->setdishID($dish_id);
$views = $objdish->viewdish();
/*echo '<pre>';
print_r($views);
echo '</pre>';*/
foreach ($views as $value) {
    ?>
<form name="form1" method="post" action="process/process_update_dish.php">
  <table width="669" border="1">
    <tbody>
      <tr>
        <th colspan="2" scope="row">Please Edit dish</th>
      </tr>
      <tr>
        <th scope="row">Title</th>
        <td>
		<input type="text" name="title" value="
		<?php 
    echo $value['dish_title'];
    ?>
"/>		
		
        
      </tr>
      <tr>