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>"; } } Quote Link to comment 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'. Quote Link to comment Share on other sites More sharing options...
gizmola Posted June 2, 2009 Share Posted June 2, 2009 Where is your tags? Quote Link to comment 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. Quote Link to comment 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>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.