View Single Post
Old Apr 11th, 2006, 4:46 PM   #1
ASHORY
Programmer
 
ASHORY's Avatar
 
Join Date: Dec 2004
Location: Egypt
Posts: 30
Rep Power: 0 ASHORY is on a distinguished road
Send a message via ICQ to ASHORY Send a message via MSN to ASHORY Send a message via Yahoo to ASHORY
Unhappy 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 :&nbsp;".$j."&nbsp;Not saved";
}
else{
echo "Code ID :&nbsp;".$j."&nbsp;Is saved";
}
$j++;
}
}
?>
</body>
</html>[/PHP]
__________________
"^Ahmed.SHOukRY^"
http://www.ashory.741.com
ASHORY is offline   Reply With Quote