Hi all,
Can anyone tell me why i'm getting the following error?
Warning: Invalid argument supplied for foreach() in /usr/local/etc/httpd/sites/kosbab.org/mystiquemodels.net/htdocs/admin/admin.php on line 13
I'm trying to echo the results of an array.
The following code is on the page called admin.php
Here is the form that passes the results:
<form method="post" action="admin.php">
<p><strong>Current Positions:</strong> <br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$result_pos = mysql_query("SELECT lady_id,first_name,last_name FROM ladies");
$total_pos = mysql_num_rows($result_pos);
while ($row_pos = mysql_fetch_array($result_pos)) {
$lady_id[] = $row_pos["lady_id"];
$first_name[] = $row_pos["first_name"];
$last_name[] = $row_pos["last_name"];
}
$num = 1;
while ($num <= $total_pos){
?>
<tr>
<input name="lady_id" type="hidden" value="<? echo $lady_id[$num-1]?>">
<td><? echo $first_name[$num-1] ?></td>
<td><input name="last_name" type="text" value="<? echo $last_name[$num-1]?>"></td>
</tr>
<?
$num++;
}
?>
</table>
<br>
<input name="total_pos" type="hidden" value="<? echo $total_pos ?>">
<input name="update_position" type="submit" value="Update">
</form>
...and this is what i am trying to echo:
foreach($lady_id as $k,$v){
echo "$lady_id[$k] $last_name[$k]<br>";
}
Can anyone see why i would be getting this error?
Cheers,
micmac