will35010 Posted June 2, 2009 Share Posted June 2, 2009 I have two php functions that generate options for select menus. The menu displays properly, but the value isn't being passed. The value is supposed to be $row['dl'] function getDrivers() { require('opendb.php'); $result = mysqli_query($conn, "SELECT fname, lname, dl FROM drivers"); while($row = mysqli_fetch_array($result)) { echo "<option value=\"" . $row['dl'] . "\">".$row['lname'].",".$row['fname']."</option>"; } } The value is supposed to be $row1['vin'] function getVehicles() { require('opendb.php'); $result1 = mysqli_query($conn, "SELECT vin, plate, year FROM vehicles"); while($row1 = mysqli_fetch_array($result1)) { echo "<option value=\"" . $row1['vin'] . "\">".$row1['plate'].",".$row1['year']."</option>"; } } Link to comment https://forums.phpfreaks.com/topic/160708-solved-select-value-not-being-passed/ Share on other sites More sharing options...
will35010 Posted June 2, 2009 Author Share Posted June 2, 2009 I fixed the second function. I had $row instead of $row1. I still can't get the first one to pass 'dl'. Link to comment https://forums.phpfreaks.com/topic/160708-solved-select-value-not-being-passed/#findComment-848134 Share on other sites More sharing options...
gizmola Posted June 2, 2009 Share Posted June 2, 2009 Where is your tags? Link to comment https://forums.phpfreaks.com/topic/160708-solved-select-value-not-being-passed/#findComment-848135 Share on other sites More sharing options...
will35010 Posted June 2, 2009 Author Share Posted June 2, 2009 Where is your <select> </select> tags? They are on the actual form. I have <?php echo getDrivers() ?> in between the tags. It works for getVehicles() and passes the value, but getDrivers() doesn't pass the value of dl. Link to comment https://forums.phpfreaks.com/topic/160708-solved-select-value-not-being-passed/#findComment-848138 Share on other sites More sharing options...
ldougherty Posted June 2, 2009 Share Posted June 2, 2009 All the escaping is killing my eyes.. try echo "<option value='$row[dl]'>$row[lname] $row[fname]</option>"; Link to comment https://forums.phpfreaks.com/topic/160708-solved-select-value-not-being-passed/#findComment-848143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.