I have this form page
<!DOCTYPE html>
<html>
<head>
<title>Navigation</title>
</head>
<body>
<form name="form" method="POST" action="capstone.php">
<fieldset>
<p>Where are you trying to go? </p>
<input type="roominput" name="mapinput" id="mapinput">
<br />
<br />
<input type="submit" name="submit" value="Submit">
</fieldset>
</form>
</body>
</html>
I have this php code that matches user input from the form page with the sql database and echos if the room exists or not.
How do I change this code in order to match user input from the form page with the database and post different images depending on the user input from the form?
<?php
$conn=mysqli_connect("localhost","xxx","xxx","xxx");
if (mysqli_connect_errno())
{
echo "Connect failed: " . mysqli_connect_error();
exit();
}
if (isset($_POST['mapinput']))
{
$map = $_POST['mapinput'];
$query = "SELECT * FROM `Rooms` WHERE `Room Number` ='$map'";
$result = mysqli_query($conn,$query);
if (mysqli_num_rows($result))
{
echo 'Room already exists';
}
else
{
echo 'Room does not exist, please try again.';
}
}
mysqli_close($conn);
?>