Jump to content

[SOLVED] select value not being passed


will35010

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.