steelerman99 Posted September 17, 2007 Share Posted September 17, 2007 Hello again! I have a page with a drop down box at the top with 4 options. I have 4 drop down boxes further down the page with data that correspond to the choices in the first one (ie- the top box is a category and the 4 boxes further down the page correspond to those categories.) What i want to do is have the user select something from the top box, then enable one of the 4 drop downs down the page and disable the rest (or show/hide. whichever works). For example: if i choose option #2 in the top box, i want box #2 to be enabled and the others disabled (or show/hide). Can anyone tell me how i can accomplish this? I'm using php if that makes a difference. Thanks again!! Quote Link to comment https://forums.phpfreaks.com/topic/69699-dynamic-page/ Share on other sites More sharing options...
steelerman99 Posted September 17, 2007 Author Share Posted September 17, 2007 Edit: The above post is wrong. I only have one drop down box at the bottom of the page. What i want to do: when the user clicks one of the options in the box at the top of the page, i want the box at the bottom of the page with data that corresponds to the top. So for example. The top box choices are fruit and colors. If the user clicks on colors, box2 at the bottom will have choices of red, green, blue. If the user clicks on fruit at the top, the box will change to apple, banana, grape. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/69699-dynamic-page/#findComment-350211 Share on other sites More sharing options...
steelerman99 Posted September 17, 2007 Author Share Posted September 17, 2007 Actually i'll use either post. If you can solve either of those, i'll take it! Quote Link to comment https://forums.phpfreaks.com/topic/69699-dynamic-page/#findComment-350220 Share on other sites More sharing options...
asparagus Posted September 19, 2007 Share Posted September 19, 2007 Just taking a stab at your second one. It's crude but it seems to work. Is this what you're looking for? <html> <body> <form action="NoName.php" method="post" name="form1"> <div> <select name="list"> <option value="red"> red</option> <option value="blue"> blue</option> <option value="green"> green</option> </select></div> <div><input type="submit" value="submit" name="submit"></div> </form> <?php // if submit if (isset($_POST['submit'])){ // get variable $list = $_POST['list']; //if conditionals if ($list == "red") { // you can either include the form action here or just the drop down box div or just the select code echo '<form action="page.php" method="post" name="form2"> <div><select name="list_one"> <option value="apple"> apple</option> <option value="orange"> orange</option> <option value="banana"> banana</option> </select></div> <div><input type="button" value="submit" name="submit"></div> </form>'; } if ($list == "blue") { echo '<form action="page.php" method="post" name="form3"> <div><select name="list_one"> <option value="Ford"> Ford</option> <option value="Toyota"> Toyota</option> <option value="Porsche"> Porsche</option> </select></div> <div><input type="button" value="submit" name="submit"></div> </form>'; } //.... whatever other options you need. } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/69699-dynamic-page/#findComment-350884 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.