I have the following basic HTML form:
<form action="" method="post">
Name: <input type="text" name="name" /><br><br>
College: <select name = "colleges">
<option> ---Select College---</option>
<option value="option1">DIT</option>
<option value="option2">University College Dublin</option>
</select><br><br>
Email: <input type="text" name="email" /><br><br>
Password: <input type="text" name="password" /><br><br>
Location: <input type="text" name="location" /><br><br>
<button type="submit" name="submit" >Submit</button>
</form>
And the following section of PHP which I am quite new to:
if(isset($_POST["submit"])) {
$name = $_POST["name"];
$college_name = $_POST["college"];
$email = $_POST["email"];
$password = $_POST["password"];
$location = $_POST["location"];
}
$sql = "INSERT INTO user(name, college, email, password, location) VALUES ($name, $college_name, $email, $password, $location)";
?>
My database has college as an int, so DIT would be 1 in the database. Can anyone tell me how to do this so that it sends 1 as college_name instead of the actual name that the user sees?