Jump to content

PRE-Search post to self without page reload...


antonyfal

Recommended Posts

Howsit?.

 

I have a search function, it works well, but i have it setup, so that i have a Pre-Search form built into my search form.. Here the user selects gender, and several other criteria.. On submit, the search form shows with dropdowns and language files specific to the users pre-selected criteria..

 

The problem i have is the url that it posts to -- also belongs to another module i have in my system, and i cant change that..

 

What i need to do is: post to a page.php, and then have the information parsed back to the search - (javascript, or ajax) or php ..

 

How would i setup the page.php to show the "postintegratedsearch" here??

if you look at the code bellow:

the"postintegratedsearch" is a hidden field, when the user submits, the same form picks up the post and the search is revealed.. i need to do this with a page.php and without page re-load..

 

i hope this is the correct forum..

 

<?php
	some php code here
		?>						
		<br><form method="post" action="???">
		<center><table width="50%" style="border:1px solid #444444">
		<tbody><tr><td colspan="1">Gender:</td><td colspan="1"><select name="searchgender" id="searchgender" class="inputbox">
		<option value="Male">Male</option>
		<option value="Female">Female</option>
            </select></td></tr><tr><td colspan="2" style="text-align:right"><input type="image" value="Submit" name="Submit" alt="Submit" src="http://www.link_to_image.png">
<input type="hidden" value="1" name="postintegratedsearch"></td></tr>			
</tbody></table></center>
</form>
<?php
	init_javascript();

	if ($calledBySearchModule == "" && isset($_REQUEST['calledBySearchModule']) )
		{
		$calledBySearchModule=myappGetParam( $_REQUEST, 'calledBySearchModule',"" );
		}

	if ($calledBySearchModule == "" && !isset($_REQUEST['next'])  )
		{			
		if ($_POST['postintegratedsearch'] == '1' && $jrConfig['integratedSearch_enable'] =='1')
			{
			$calledBySearchModule="mod_appsearch_a0";
			}
		}

		more php here -- here i have all the database dropdowns 

?>

Link to comment
Share on other sites

I have got a couple of forms already on my site using post and ajax return, but this form is slightly different..  I did some more research... i think what i need here is a way to post the first form to a second form on the same page?? and possibly without page refresh needed..

 

IE:

// this echoed form is on the search.php page, which $output's to the search .html page

echo '<form id="pre-search" name="pre-search" action="????" method="post">

<input type="hidden" name="postintegratedsearch" value="1" >

</form>';

 

 

// this form is on the search.html page.. but gets its values from the search.php page

<form id="search" name="search">

 

if ($_POST['postintegratedsearch'] == '1')

{

some code here

}

</form>

 

I need the pre-search form to remove and add cirtain criteria to the main search.php so that it outputs only what is requested to the search.html..

 

It all works well but i cannot use the url-- i also have sef on my system..

 

So basically i need  // im thinking// to get the values sent from one form to the next form without page-reload.. in this way the main search should show with the pre-selected criteria.. the url used will still remain available for its module and i can go have some beers since its friday..

 

 

how should the setup of the two forms look?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.