I have a problem to get a selected value and output it. Example i select 1001 from dropdown. When I echo it always return the value from first row wish is 1002.
this my code edit.php
<form id="form" action="test.php" method="post">
<?php
echo "<select name=\"Reservation ID\" form=\"form\">";
while ($row = mysqli_fetch_array($result))
{
$gg = $row['reserve_id'];
echo "<option value='" . $gg . "' name=\"reserve_id\">" . $gg . "</option>";
}
echo "</select>";
$_SESSION['reserve'] = $gg;
?>
<input type="submit" name="form" value="Submit">
</form>
this is code from test.php
$y = $_SESSION['reserve'];
if(isset($_POST['form']))
{
echo $y;
}