chris8726 Posted May 1, 2007 Share Posted May 1, 2007 I am trying to place a section of PHP inside another section of PHP to create a persistent menu system. What it is, is a main menu that when an option is selected uses PHP to bring up another menu, and when an option is selected in that menu it uses PHP to either bring up another menu or a description of an item. You can look at the system here. What I want to do with it is have the menu stay on the selected item as you go through. I can get the top level to stay, but the lower levels of the menu are their own php scripts and I don't know how to make another php script work inside another script. If you have any ideas please let me know. Link to comment https://forums.phpfreaks.com/topic/49503-nested-php/ Share on other sites More sharing options...
leev3 Posted May 1, 2007 Share Posted May 1, 2007 Are you trying to make a drop down menu, in which each item is a reference to another php page? Link to comment https://forums.phpfreaks.com/topic/49503-nested-php/#findComment-242687 Share on other sites More sharing options...
chris8726 Posted May 1, 2007 Author Share Posted May 1, 2007 Each menu bring up either another menu on the same page or an item and description on the same page. <a href="http://www.rentalcityomaha.com/specialevent.php">You can look at the system by clicking on this sentence!</a> Link to comment https://forums.phpfreaks.com/topic/49503-nested-php/#findComment-242708 Share on other sites More sharing options...
chris8726 Posted May 3, 2007 Author Share Posted May 3, 2007 Can anyone at all help me with this? Link to comment https://forums.phpfreaks.com/topic/49503-nested-php/#findComment-244253 Share on other sites More sharing options...
thedarkwinter Posted May 3, 2007 Share Posted May 3, 2007 Hi I think you should be doing this with one script? (nesting??) <?php $menu1value = $_POST["menu1"]; $menu2value = $_POST["menu2"]; $menu3value = $_POST["menu3"]; // build the select $menu1 = "<select name='menu1' onchange='Submit();'><option value='a'>a</option></option2.3.4.4.>"; // this line selects the posted value (there might be a better way to do it) $menu1 = str_replace("option value='$menu1value'>", "option value='$menu1value'> selected", $menu1); if ($menu1value == "a") { $menu2 = "<select name='menu2' onchange='Submit();'><option value='z'>z</option></option2.3.4.4.>"; } else if ($menu1value == "b") { // whatever } $menu2 = str_replace("option value='$menu2value'>", "option value='$menu2value' selected>", $menu1); // repeat above for menu3 // html code etc... echo "<form method='post'>"; echo $menu1; echo $menu2; echo $menu3; echo "</form> // blah blah more html ?> or something along those lines Does that help? Cheers, tdw Link to comment https://forums.phpfreaks.com/topic/49503-nested-php/#findComment-244331 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.