I have been struggling with option value for some time already. Have checked a lot of stuff on here, but nothing helps in my situation. So, basically I am trying to get an option value from one table and insert it in another one, but it just inserts “0” in the column.
Code:
<select name="driver_id" id="driver_id" class="form-control" required="">
<option value="">Choose driver</option>
<?php
$sql = "SELECT * FROM `league_driver` `u`
INNER JOIN `calendar_dates` `c` ON `c`.`league_id` = `u`.`league_id`
WHERE `c`.`id` =".$_GET['id'] ;
$result = $con->query($sql);
if ($result) {
while ($row = $result->fetch_assoc()) {?>
<option value="<?=$row['driver_id'];?>"><?=$row['driver_id'];?> - <?=$row['team_id'];?></option>
<?php }
}
?>
</select>
I thought maybe something is messing up with WHERE clause, tried to remove it, same thing happens.