I have this Filipino Dishes on my database. But I can't put any data on the show.
img name price show
curry.jpg | Chicken Curry | 40 |
karekare.jpg | Pork Kare Kare | 60 |
nilaga.jpg | Nilagang Baboy | 65 |
ptapa.jpg | Pork Tapa | 40 |
sisig.jpg | Sisig | 40 |
I want to insert data on the shown column using checkbox. Below is my code.
<?php
echo '<form method="post" action="products.php">';
include('../store/connect.php');
$result = mysql_query("SELECT * FROM internet_shop");
while($row = mysql_fetch_array($result))
{
echo '<tr class="record">';
echo '<td>'.'<input type="checkbox" value="yes" name="Items[]">'.'</td>';
echo '<td>'.$row['name'].'</td>';
echo '<td><div align="left">'.'₱'.$row['price'].'</div></td>';
echo '<td><a rel="facebox" href="editproductimage.php?id='.$row['id'].'"><img src="../store/img/products/'.$row['img'].'" width="80" height="50"></a></td>';
echo '<td><div align="center"><a rel="facebox" href="editproductetails.php?id='.$row['id'].'">edit</a> | <a href="#" id="'.$row['id'].'" class="delbutton" title="Click To Delete">delete</a></div></td>';
echo '</tr>';
}
echo '<input type="submit" name="submit" value="submit">';
echo '</form>';
?>
<?php
if(isset($_POST['submit'])){
if(!empty($_POST['Items'])) {
foreach($_POST['Items'] as $value){
$sql = "UPDATE internet_shop SET show = $value";
}
}
}
?>
But I can't seem to insert data to the show column using this code. I want to do this so that I will only just check the items that is checked using the ("SELECT * FROM internet_shop WHERE show='yes'")
query.
Aucun commentaire:
Enregistrer un commentaire