Hello,
Can anyone tell me why the $list_id variable is passing the last value in the DB and not the list_id associated with that row?
When $featured == 'true' the list_id displays correctly but when i try to submit it it displays the last $last_id in the DB.
Here is the code:
if ($update_featured){
echo "$list_id<br>$featured<br>";
if ($result){
echo "Updated successfully";
} else {
echo "Your details could not be updated";
}
} else if ($featured == 'true'){
?>
<form action="edit_properties.php" method="post">
<?
$link = mysql_connect('localhost', '', '');
mysql_select_db('melb');
$query = "SELECT list_id, address, featured FROM list";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$list_id = $row['list_id'];
$address = $row['address'];
$featured = $row['featured'];
echo "<img height=\"13\" src=\"images/here.gif\" width=\"13\" > <input name=list_id type=text value=\"$list_id\" size=3 readonly> <font color=\"red\">$address</font> <input name=\"featured\" type=\"radio\" value=\"yes\"";
if($featured == 'yes') echo "checked";
echo "><br>";
}
?>
<br>
<input name="update_featured" type="submit" value="Submit">
</form>
<?
} else if($edit == 'true'){
$link = mysql_connect('localhost', '', '');
mysql_select_db('melb');
$query = "SELECT list_id, address FROM list";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo "<img height=\"13\" src=\"images/here.gif\" width=\"13\" > <a href=\"edit_properties_result.php?id={$row['list_id']}\"><font color=\"red\">{$row['address']}</font></a><br>\n";
}
}
Any ideas appreciated.
Thanks,
chrima