Ok below I will link a screenshot to show you what I'm working with so far.
In the left box I was to fill it with a list of 'EventIDs' which are the primary key on my database table.
When one of these IDs is selected I want the 'EventName' from the same table to appear in the box to the right.
https://gyazo.com/79e5e49bd288838c8ce1ae54fe245494
The problem so far is that the Event name is showing in the left select box and I'm not sure how to make it fetch data from the table when selected and to output in the text box. Hope that makes sense
Here is my code:
<!DOCTYPE html>
<html>
<head> </head>
<body>
<?php include 'login.php';?>
<select name="EventID">
<option value="">Select Event ID</option>
<?php
$result1 = mysqli_query($dbconnect, "SELECT EventID, EventName FROM event");
while($row1 = mysqli_fetch_assoc($result1)) {
?>
<option value="<?php echo $row1['EventID']; ?>"><?php echo $row1['EventName']; ?></option>
<?php
// End while loop.
}
?>
</select>
Event Name: <input name="EventName" type="text">
</body>
<html>