alicefreak Posted August 19, 2010 Share Posted August 19, 2010 Ok here is what im trying to do: 1. drop down list pulled from mysql database.( working ) 2. after you select the name in the drop down list 3. Use selected name to another page. here is code <?php include('include/db_connection.inc'); $table = "truck_master"; $result = mysql_query( "SELECT driver_name FROM $table" ); $options=""; while ($row=mysql_fetch_array($result)) { $driver_name=$row["driver_name"]; $options.="<OPTION VALUE=\"driver_name\">".$driver_name.'</option>'; } ?> <html> <head> </head> <body> <table align="center"> <form name="form1" method="GET" align="center" action="issue.php"> <tr> <td>Driver Name :</td> <td><SELECT name="driver_name"><OPTION VALUE=''>Choose<?php echo $options?></SELECT> </td> </tr> <tr> <td><input type="submit" name="Submit" value="Submit"> </td> </tr> </form> </table> </body> <html> Second Code IS $driver = $_GET['driver_name']; Link to comment https://forums.phpfreaks.com/topic/211153-passing-a-variable-from-a-drop-down-in-a-form/ Share on other sites More sharing options...
Sergey Popov Posted August 19, 2010 Share Posted August 19, 2010 You need to correct this line in your code: $options.="<OPTION VALUE=\"driver_name\">".$driver_name.'</option>'; so that it look like this: $options.="<OPTION VALUE=\"".$driver_name."\">".$driver_name.'</option>'; Link to comment https://forums.phpfreaks.com/topic/211153-passing-a-variable-from-a-drop-down-in-a-form/#findComment-1101155 Share on other sites More sharing options...
alicefreak Posted August 19, 2010 Author Share Posted August 19, 2010 thanks Link to comment https://forums.phpfreaks.com/topic/211153-passing-a-variable-from-a-drop-down-in-a-form/#findComment-1101288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.