legohead6 Posted April 17, 2006 Share Posted April 17, 2006 im making a thing kinda like when you dial a phone to a company (I.E press 1 for english, 2 for french.....then when you hit 1 it comes up hit 1 to talk to sales...hit 2 to talk to customer support...etc..etc)you know what i mean.....well in order to do this i used switch... but it doesnt seem to work...because it requires a switch to be inside a switch... heres the page....[a href=\"http://www.mattswebpage.com/other%20tests/phoneline%20idea.php\" target=\"_blank\"]Phone line idea[/a]and heres the script(no switches inside switches yet)[code]<html><form name="p1" method="GET"><b>Step 1:</b><br>Press 2 to go to mattswebpage<br>Press 1 to go to splatmen<br>Press 3 to go to LIFD<br><input type="text" name="ppp" size="2" value="0"><input type="submit" name="submit1" value="Next"></form><?phpif(isset($_GET['submit1'])){$ppp=$_GET['ppp'];switch($ppp){case '0':echo "Please Enter a number from 1-3!";break;case '1':echo "<b>Step 2:</b><br>Forums Press 1<br>Home Press 2<br>chat room Press 3<br><form name='p2' method='get'><input type='text' name='pp2' value='0' size='2'><input type='submit' name='submit2' value='Next'></form>";$pp2=$_GET['pp2'];break;case '2':echo "<b>Step 2:</b><br>Forums Press 1<br>Home Press 2<br>chat room Press 3<br>contact Press 4<br><form name='d3' method='post'><input type='text' name='pp3' value='0' size='2'><input type='submit' name='submit3' value='Next'></form>";break;case '3':echo "this would look something like the others.....";break;case '4':echo "this isnt a valid number";break;}} ?>[/code] Link to comment https://forums.phpfreaks.com/topic/7626-including-a-switch-in-a-switch/ Share on other sites More sharing options...
wildteen88 Posted April 17, 2006 Share Posted April 17, 2006 Switch statements can be inbeded in side each other:[code]switch($foo){ clase 1: switch($foobar) { case 1: }}[/code] Link to comment https://forums.phpfreaks.com/topic/7626-including-a-switch-in-a-switch/#findComment-27861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.