I am trying to loop the results of a query into a form. I want the user to be able to select using a submit button on this form, what results they want to view. The post all the data into the next page.
There is something wrong with my code, but I am not sure what? Anyhelp would be greatly appreciated.
This is the code that I am using right now. From this you should be able to see what I am trying to do.
$result = mysql_query("SELECT Count( reservation.RoomID ) AS CountOfRoomID, reservation.RoomID, Rooms.RoomID, Rooms.RoomName, Rooms.BuildingName, Rooms.RoomNumber, Rooms.BuildingType, Rooms.Address, Rooms.City, Rooms.Province, Rooms.Country, Rooms.Owner_ManagerID, Rooms.Dailyratehigh, Rooms.Dailyratelow, Rooms.Weeklyratehigh, Rooms.Weeklyratelow, Rooms.Monthlyratehigh, Rooms.Monthlyratelow, Rooms.Roomsize, Rooms.URLLink
FROM reservation, Rooms
WHERE ((((reservation.RDate) >= '$checkindate')
AND ((reservation.RDate) <= '$checkoutdate'))
AND ((reservation.Availability) = 'Vacant')
AND (reservation.RoomID = Rooms.RoomID)
AND ((Rooms.City) = '$csel'))
GROUP BY reservation.RoomID
");
while($row = mysql_fetch_array($result))
{
echo "<form method="link" action="$row['URLLink']">";
echo "<table>";
echo "<tr>";
echo "<td>" . $row['BuildingName'] . "</td>";
echo "<td>" . $row['RoomName'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan="2">";
echo "<input type="submit" name="submitroom" value="View Room">";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
mysql_close($con);
?>
Any help is greatly appreciated. I will try anything.