I am trying to pull data from a table to fill a drop down list. Now, i got the fill part working, but am having an issue passing a variable value to my form post action.


$query ="SELECT UniqueIdentifier, LastName, FirstName
FROM BrokerMain
ORDER BY LastName";
$result = @mssql_query($query);

echo "<select name='test'><option value='default'>Choose a Broker:</option>";
while ($row=mssql_fetch_array($result))
$spacer= ", ";
echo "<option value='$uid'>" . $ln . $spacer . $fn . "</option>";
echo "</select>";
echo "<form action='editbroker.php?UniqueIdentifier=$uid' method='post'><td valign='top'><input type='submit' name='edit' value='Edit'/></form>";

End Code

The button is there, but the value of $uid is not being passed based on the user selected in the drop down box. Any ideas?

6 Years
Discussion Span
Last Post by novedturn

Makr sure that the field name 'UniqueIdentifier' is correct. Anyway, what is the type of this 'UniqueIdentifier' field ?
Try with this:

echo "<option value='" . $uid . "'>" . $ln . $spacer . $fn . "</option>";

Instead of:

echo "<option value='$uid'>" . $ln . $spacer . $fn . "</option>";

made the change, still no luck. I am positive that the field name UniqueIdentifier is correct. if i take the form line and put it in the while loop, the query works, i get a submit button for each record in the drop down and it grabs the $uid value and passes it to the next page. only issue is, i have 900 submit buttons. i need just one, that changes the value based on who i chose in the drop down list.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.