Forum Moderators: coopster
<?php
echo('<form method="post" action="'.$self.'">');
$delid = $_POST['carid'];
$how_many=count($delid);
if ($how_many>0)
{
$sql1= "SELECT * FROM cars WHERE car_id = $delid";
$rs=mysql_query($sql1,$conn);while($row = mysql_fetch_array($rs))
{
echo ("EDITING records:<br>");
for ($i=0; $i<$how_many; $i++)
{
echo (($i+1) . " - " . $delid[$i] . "<br>");
echo ('Reg No:<input type="text" name="reg" size="8" value="'.$row["reg_no"].'">');
}
echo('</form>');
}
}
?>
carid is the array in which the options from the HTML checkbox form are stored. the INT value of these are correspondent to the values of the primary key in the table.
Im getting : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in editcar.php on line 55
(i intend to put the update code underneath it all, so it updates when the second new button is pressed, hence the $self in the second form)
[edited by: Esqulax at 3:42 pm (utc) on Feb. 25, 2008]
echo('<form method="post" action="'.$self.'">');
$delid = $_POST['carid'];
$how_many=count($delid);
if($how_many>0){foreach ($_POST['carid'] as $val)
{
$sql = "SELECT * FROM cars WHERE car_id = '$val'";
$rs1=(mysql_query($sql));while($row = mysql_fetch_array($rs1))
{
echo ('Reg No:<input type="text" name="reg" size="8" value="'.$row["reg_no"].'"><br>');
echo('</form>');}
}}
methinks i got a bit confused with the $_POST being an array