Cant Make it With Check Boxes
I was tring to make an example to check one or more Checkbox then click edit , so a new page opened to make me edit the checked areas i made a script but i couldnt find out what the problem with it ,
can any body help ..
[PHP]<head>
<title>Edit Code</title>
</head>
<body>
<?php
$ID = $_POST['row_id'];
$ID_Count=count($ID);
if (!isset($_POST['save'])) {
$i=0;
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method=post>
<?php
while ($i < $ID_Count){
echo "Code ID :".$ID[$i]."<br />";
echo "Enter new code :";
?>
<input type="text" name="edit_<?php echo $i ; ?>">
<?php
}
?>
<input type=submit name=save value=Save>
</form>
<?php
}
else{
$j=0;
while ($j < $ID_Count){
$Form_Code=$_POST['edit_'.$j];
$Edit_Code="UPDATE Codes SET Code='".$Form_Code."'WHERE ID='".$ID."'";
$Edit_Query=mysql_query($Edit_Code);
if (!$Edit_Query){
echo "Code ID : ".$j." Not saved";
}
else{
echo "Code ID : ".$j." Is saved";
}
$j++;
}
}
?>
</body>
</html>[/PHP]
|