OK I made some changes to the code.
<?php
require ("Functions.php");
#geting the destinations
$link = Connect();
$destinations_query = "SELECT * FROM destinations
WHERE Held_In_Destination > 1";
$destinations_result = mysqli_query($link, $destinations_query);
#creating a form containing a destination list.
#The form will pass on a destination ID to the next form
#that shows hotels in the area.
echo "<form action='MakeAnOrder.php' method='POST'>
<strong>Select Your Destination</strong>
<select name='Destination_Name'>\n";
while ($destinations_row = mysqli_fetch_array($destinations_result))
{
extract ($destinations_row);
echo"<option value = '$Destination_Name'>$Destination_Name\n";
}
echo"</select>\n";
echo"<input type = 'hidden' name = 'Destination_ID' value = '$Destination_ID'>";
echo "<input type = 'submit' value = 'Select'>
</form>\n";
mysqli_close ($link);
?>
<?php
#Selecting a hotel
$Destination_ID = SelectDestinationID(isset($_POST['Destination_Name']));
echo"$Destination_ID";
$hotels = Hotels('$Destination_ID');
echo "<form action='MakeAnOrder.php' method='POST' >
<strong>Select a Hotel</strong>
<select name='Hotel_Name'>\n";
while ($hotels_row = mysqli_fetch_array($hotels))
{
extract ($hotels_row);
echo"<option value = '$Hotel_Name'>$Hotel_Name\n";
}
echo"</select>\n";
echo "<input type = 'submit' value = 'Select'>
</form>\n";
#When both forms are created, the Destination_ID doesn't transfere to the second form
?>
When I echo a Destination_ID in the second part of the code, it turns out to be fine. But the form still doesn't display the hotel names![]()




Reply With Quote