I have a form which is capturing input values as session params. One input in particular is a select with 5 different options ( cell phone carriers). I want the form to submit the id (carrier_id) but echo out the associated value (carrier_name) on a confirmation page.
Something like this:
<form action="confirm_form.php" role="form">
<div class="form-group">
<label for="carrier>Select Carrier</label>
<select type="text" class="form-control" name="carrier" value="">
<?php
$q = "SELECT * FROM carriers";
$carriers = mysqli_query($con, $q);
while($row = mysqli_fetch_assoc($carriers)) {
$carrier_id = $row['car_id'];
$carrier_name = $row['car_name'];
echo "<option value='$carrier_id'>$carrier_name</option>";
}
?>
</select>
</div>
<button type="submit" value="submit" name="submit">Add customer</button>
</form>
$carrier = mysqli_real_escape_string($con, $_SESSION['carrier']);
The confirm_form.php page should echo out the carrier name but when i tried it either outputs the carrier_id or blank. Please help.
Im also assuming other factors in this quick overview which i didnt type out. ( i already have session_start(); called, for one)