0

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.

Code:

$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))
{
$uid=$row;
$ln=$row;
$fn=$row;
$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?

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by novedturn
0

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>";
0

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.