The user selects a room type, from a radio button based form, and is "switched" to the room of their choice.
However the URLS in the SWITCH statement do not work?
What am I doing wrong.
Below is a sample of the code that is failing.
<?php
//set switch value
if (isset($_POST['submit']))
switch ($_POST['group1'])
{
case "R1":
echo '<a href = "http://www.ychdb.co.uk/living_room.php">Go to Living room</a><br>';
break;
case "R2":
echo '<a href= "http://www.ychdb.co.uk/dining_room.php">Go to Room 2</a><br>';
break;
case "R3":
echo '<a href= "http://www.ychdb.co.uk/other_room.php">Go to room 3</a>';
break;
default:
echo '<a href= "http://www.ychdb.co.uk/no_room.php">Go to any other room</a>';
break;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Select room type</title>
</head>
<body>
<table width="100%" height="50%" border="2" bgcolor="green">
<tr>
<td></td>
<td>
<form name="chooseroom" method="post">
<div align="left"><br>
<input type="radio" name="group1" value="R1"> Living Room<br>
<input type="radio" name="group1" value="R2"> Dinning Room<br>
<input type="radio" name="group1" value="R3"> Kitchen<br>
<input type="radio" name="group1" value="R4"> Laundry/Utillity Room<br>
<input type="radio" name="group1" value="R5"> Bedroom<br>
<input type="radio" name="group1" value="R6"> Garage<br>
<input type="radio" name="group1" value="R7"> Other<br>
</div>
<input type="submit" value="submit" name="submit"><br />
</form>
</td>
<td bgcolor="white">Room for results
</td>
<td bgcolor="white"></td>
</tr>
</table>
</body>
</html>
Help please