Forum Moderators: coopster
Heres what i got:
echo('<form method="post" action="'.$self.'">');
$upid = $_POST['carid'];
$how_many=count($upid);
$reg =$_POST['reg'];
if ($how_many>0)
{
echo ("You chose the following records:<br>");
for ($i=0; $i<$how_many; $i++)
{
$sql = "SELECT * FROM cars WHERE car_id = '$upid[$i]'";
$rs1=(mysql_query($sql,$conn));while($row = mysql_fetch_array($rs1)){
echo (($i+1) . " - " . $upid[$i]. $row['car_id']."<br>");
echo ("<input type=\"hidden\" name=\"updateid[]\" value=\"{$upid[$i]}\"> ");
echo ('Reg No:<input type="text" name="reg" size="8" value="'.$row["reg_no"].'"><br>');
}
}echo("Ok to update ".$how_many." record(s)?");
echo('<input type="submit" name="submit" value="Yes">');echo('</form>');
}
foreach($updateid as $val1)
{
$sql3="UPDATE cars SET reg_no= '$reg' WHERE car_id ='$val1'";
mysql_query($sql3);
}
The error i get says:
Warning: Invalid argument supplied for foreach() in editcar.php on line 73
but im pretty sure i activated that array a little above.. any ideas?