drop down list
Posted: Sat Oct 21, 2006 6:21 pm
I have a table called "upload" with a few columns that are being populated by an upload script. I would like to be able to return data in the column name "name" onto the screen within a drop down. When the "name" is selected from the dropdown you are redirected to a "details.php?id=1" page that displays the contents of that row in the database. IT SOUNDS SO EASY but I am having trouble getting data into the select and getting that to navigate to a different page with actual details on it. I have something like this:
I just want to be able to select something from the drop down (i.e. data from a specific column, in this case "name") and when it's selected it will send the user to a page w/ the data for that row on the page.
Any help is much appreciated.
Thanks,
JOsh
Code: Select all
<?php
echo "<select name=\"name\">";
echo "<option size =30 selected>Select</option>";
if(mysql_num_rows($sql_result))
{
while($row = mysql_fetch_assoc($sql_result))
{
echo "<option>$row[name]</option>";
}
}
else {
echo "<option>No Names Present</option>";
}
?>Any help is much appreciated.
Thanks,
JOsh