Jump to content

Search problem


besly98

Recommended Posts

Hi All,

 

i have used the following code on this tutorial,

http://www.jeffadams.co.uk/2009/08/31/auto-suggest-with-php-jquery/

 

but when im querying my database, i need to send through another value as well as the search value.

 

So basically i need to  send 2 values through to the search page. I have tried many options but cant get this to work. Any ideas?

 

Thanks

 

Link to comment
Share on other sites

 <form>
<div>
<h3>Band Name</h3>
<input type="text" size="30" value="" id="inputString"
onkeyup="lookup(this.value);" onblur="fill();" />
</div>
<!-- hide our suggestion box to begin with-->
<div class="suggestionsBox" id="suggestions" style="display: none;">
<img src="upArrow.png" style="position: relative; top: -18px; left: 30px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList"></div>
</div>
</form>

function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
	$('#suggestions').hide();
} else {
// post data to our php processing page and if there is a return greater than zero
// show the suggestions box
$.post("string_search.php", {mysearchString: ""+inputString+""}, function(data){
 if(data.length >0) {
 	$('#suggestions').show();
		$('#autoSuggestionsList').html(data);
}
});
}
} //end

// if user clicks a suggestion, fill the text box.
function fill(thisValue) {
$('#inputString').val(thisValue);
	setTimeout("$('#suggestions').hide();", 200);
}

 

so basicaly i need to pass 2 bits of data to the submit form. but i cant get it to work. this is the original code.

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.