Possible Duplicate:
handling checked checkboxes PHP
i have this problem. I have a webpage that show car registration number and it's violation. And we can change the status of the violation from 1=not treated to 2=treated. I want to use multiple check box to choose which car registration status that i want to change here's the screenshot of my web
how i change the status of both car registration number ? here's my webpage code
<div id="content">
<div class="content_item">
<?php
$con = mysql_connect("localhost","fpjarmul","fpjarmul");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("fpjarmul", $con);
$query = "SELECT * FROM laporan WHERE status = '1'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{?>
<form action="ubahdata.php" method="post">
<input type="checkbox" name="idlaporan" value="<?php echo $row['idlaporan'] ?>" /><?php echo "ID : {$row['idlaporan']}" ?><br />
<?php echo "Nomor Polisi : {$row['platkendaraan']} <br>" .
"Status : {$row['status']} <br>" .
"Tanggal Laporan : {$row['tanggallapor']} <br><br>"; ?>
<?php
}
?>
<input type="submit">
</form>
and here's my script
<?php include 'header.php'; ?>
<?php
$con = mysql_connect("localhost","fpjarmul","fpjarmul");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("fpjarmul", $con);
$sql=("UPDATE laporan set status='2' where idlaporan='$_POST[idlaporan]'");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
?>
<?php include 'footer.php'; ?>