i do a reservation system now, it can be cancel the order. so each time member login, their order will be display. The problem is that the page display few order, but i only want to delete a order. so i put the code as below:
<tr bgcolor="#FFCC66">
<td>'.$from.'</td>
<td>'.$to.'</td>
<td>'.$date.'</td>
<td>'.$time.'</td>
<td>'.$odate.'</td>
<td>'.$seatno.'</td>
<td>RM'.$total.'</td>
<input type="checkbox" name="checkbox" value="checkbox">
<td><input name="Cancel" type="submit"id="Cancel" value="'.$count.'">
when i tick the checkbox, a order will be deleted. But the problem is i dunno how to verify that order is belong to that checkbox. so i can't delete it. hope anyone can help me ? thank u
post problem
Moderator: General Moderators
change the name property for that checkbox like
on the page your processing this data just do this
It'll say "checkbox" if checkbox was checked if not nothing.
Code: Select all
<input type="checkbox" name="hello" value="checkbox">Code: Select all
<?php
echo $_POSTї"hello"];
?>Thank ur reply, but how about other field? how to post them? b'cos system doesn't recognise the other field is below that checked box.Takuma wrote:change the name property for that checkbox likeon the page your processing this data just do thisCode: Select all
<input type="checkbox" name="hello" value="checkbox">
Code: Select all
<?php echo $_POSTї"hello"]; ?>
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You have to give the checkbox some information as to what to delete, for example an order id - a number or code that is unique to each order:
if you name the checkbox next to each record delete_order[] then you can loop through it using something like:
but you do need a unique identifier for each record.
Mac
Code: Select all
echo '<input type="checkbox" name="delete_orderї]" value="'.$orderID.'" />';Code: Select all
if (isset($_POSTї'delete_order']) {
foreach ($_POSTї'delete_order'] as $value) {
$sql = "DELETE FROM orders_table WHERE orderID = '$value'";
@mysql_query($sql) or die(mysql_error());
}
}Mac