Solarpitch Posted December 9, 2006 Share Posted December 9, 2006 Hey Guys, not quite sure what this is called as you can probably guess from the subject header! But what I am trying to do is...On my home page I have a form to search by keyword. Below that I want to have an Advanced search option but dont want to display that form on the page untill the user selects the option "Advanced Search." When they select that I want the advanced form to load onto the home page. Now, I've kinda seen sites that have done this with a url that looks something like:http://www.example.com/home.phphttp://www.example.com/home.php/mode=advanced --> When advanced option is selectedI would love some help on how to achieve this,Thanks Guys. Link to comment https://forums.phpfreaks.com/topic/30025-loading-multiple-forms-on-the-same-page-based-on-user-selection/ Share on other sites More sharing options...
ted_chou12 Posted December 9, 2006 Share Posted December 9, 2006 do you want the advance form to replace the basic one? or to add on? Link to comment https://forums.phpfreaks.com/topic/30025-loading-multiple-forms-on-the-same-page-based-on-user-selection/#findComment-138033 Share on other sites More sharing options...
Solarpitch Posted December 9, 2006 Author Share Posted December 9, 2006 Hey,emm . . probably add it on I guess. But know that you said it, it might be eaiser to just replace it. Would there be much in the difference code wise anyway? Link to comment https://forums.phpfreaks.com/topic/30025-loading-multiple-forms-on-the-same-page-based-on-user-selection/#findComment-138035 Share on other sites More sharing options...
ted_chou12 Posted December 9, 2006 Share Posted December 9, 2006 I would suggest you have the advance search as another php page, and set a new form on the orignal page, then if the check box is selected, reload the page including the php page of the advance search. :D Link to comment https://forums.phpfreaks.com/topic/30025-loading-multiple-forms-on-the-same-page-based-on-user-selection/#findComment-138036 Share on other sites More sharing options...
esukf Posted December 9, 2006 Share Posted December 9, 2006 You could do something like the following. Use an if...else on the actual search page to determine which form was submitted. ie isset($_POST['simple_search') or isset($_POST['advance_search'][code]<?php if(isset($_GET['mode']) && $_GET['mode'] == 'advance'){ ?> <a href="form.php">simple Search<a> <h1>Advance Search</h1> <form method="post" action=""> <input type="text" name="search" /><br /> <input type="text" name="criteria" /> <input type="submit" name="advance_search" value="Search" /> </form><?php } else { ?> <a href="form.php?mode=advance">Advance Search<a> <h1>Simple Search</h1> <form method="post" action=""> <input type="text" name="search" /> <input type="submit" name="simple_search" value="Search" /> </form> <?php } ?>[/code] Link to comment https://forums.phpfreaks.com/topic/30025-loading-multiple-forms-on-the-same-page-based-on-user-selection/#findComment-138040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.