On my webpage i have the below form. I am using some PHP to display the name of users in the select input. My question is this... how do I save down the id column (that I am selecting in the SQL) to the database instead of the name columns that I am displaying? All help greatly appreciated.
<form action='insertmodule.php' method='POST'>
<span class="form-group">
<input type="text" placeholder="Name" class="form-control" name="name" required/>
</span>
<br>
<div class="form-group">
<label for="exampleSelect1">Select the tutor for the module</label>
<select class="form-control" name="tutor">
<?php
include('../connections/conn.php');
$sql = mysqli_query($conn, "SELECT id, first_name, last_name FROM cater_users WHERE role = 2");
while ($row = $sql->fetch_assoc()){
echo "<option>" . $row['first_name'] . " ". $row['last_name'] . "</option>";
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary" name='sign'>Create</button>
</form>