Populating Drop Down with Existing Row
Posted: Tue Aug 25, 2009 11:10 am
Hi there,
I have a form which allows users to update information already set in a row. In this case a drop down populated with row items, with the previously specified option in the default position.
It worked fine until I tried to get the default value sorted. Now I get a 'unexpected T_ENCAPSED_AND_WHITESPACE' on that line.
Can anyone give me any advice on what I'm doing wrong here. Should I echo the row or not?
Many thanks.
I have a form which allows users to update information already set in a row. In this case a drop down populated with row items, with the previously specified option in the default position.
Code: Select all
<?php
include("connect.php");
$query="SELECT locationName FROM location";
$result = mysql_query ($query);
echo "<select name='eventLocation'><option value=''>'$row['eventLocation']'</option>";
while($nt=mysql_fetch_array($result)){
echo "<option value='$nt[locationName]'>'$nt[locationName]'</option>";
}
echo "</select>";
?>
Can anyone give me any advice on what I'm doing wrong here. Should I echo the row or not?
Many thanks.