lundi 22 octobre 2018

Show only checked products

I am developing a Meal Ordering System where Customers can order all the items in the menu that is managed by the Administrator.

Currently in my system, all the items that is added by the Admin is automatically added on the store that is seen by the customers using this code.

<?php
            require "connect.php";
            $result = mysql_query("SELECT * FROM internet_shop");
            while($row=mysql_fetch_assoc($result))
            {
                echo '<a rel="facebox" href="orderpage.php?id='.$row['id'].'&trnasnum='.$transnum.'"><img src="img/products/'.$row['img'].'" alt="'.htmlspecialchars($row['name']).'" width="210" class="pngfix" style="padding:5px 8px; " /></a>';
            }

            ?>

This is the code for the Admin to add items.

<?php
include('../store/connect.php');

    if (!isset($_FILES['image']['tmp_name'])) {
    echo "";
    }else{
    $file=$_FILES['image']['tmp_name'];
    $image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
    $image_name= addslashes($_FILES['image']['name']);
    $image_size= getimagesize($_FILES['image']['tmp_name']);

        if ($image_size==FALSE) {

            echo "That's not an image!";

        }else{

            move_uploaded_file($_FILES["image"]["tmp_name"],"../store/img/products/" . $_FILES["image"]["name"]);

            $location=$_FILES["image"]["name"];
            $type=$_POST['type'];
            $rate=$_POST['rate'];
            $desc=$_POST['desc'];

            $update=mysql_query("INSERT INTO internet_shop (name, price, description, img)
            VALUES
            ('$type','$rate','$desc','$location')");
            header("location: products.php");
            exit();
            }
    }
?>

Now what I want is to add a checkbox beside all the items that is added by the Admin. That checkbox will control the items that will be shown on the store that the Customers can view. I want to remove the showing of added items automatically and let the checkbox control what to show and what not.




Aucun commentaire:

Enregistrer un commentaire