Jump to content

Recommended Posts

Hi

 

I am working with search form in php.

 

I want my search button to work with autocomplete for three search bars. Kindly guide me with the coding for the search button to get connected with the result displaying.

 

Please find attached my header file. The autocomplete is working, fetching the values from the database but I want - when we click on search button it should display the result.

 

Thanks in advance. Expecting the reply from you soon.header.php

Link to comment
https://forums.phpfreaks.com/topic/271217-search-form/
Share on other sites

Hi

 

I am working with search form in php.

 

I want my search button to work with autocomplete for three search bars. Kindly guide me with the coding for the search button to get connected with the result displaying.

 

Please find attached my header file. The autocomplete is working, fetching the values from the database but I want - when we click on search button it should display the result.

 

Thanks in advance. Expecting the reply from you soon.

Edited by SangeethaVarun
Link to comment
https://forums.phpfreaks.com/topic/271217-search-form/#findComment-1395368
Share on other sites

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />

<script src="http://code.jquery.com/jquery-1.8.2.js"></script>

<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>

<link rel="stylesheet" href="/resources/demos/style.css" />

<script>

$(function() {

$( "#s" ).autocomplete({

source: "http://search_category.php",

minLength: 1,

select: function( event, ui ) {

$('#s').val(ui.item.s);

},

});

 

$( "#catsearch" ).autocomplete({

source: "http://search_location.php",

minLength: 1,

select: function( event, ui ) {

$('#catsearch').val(ui.item.catsearch);

},

});

 

$( "#company" ).autocomplete({

source: "http://search_company.php",

minLength: 1,

select: function( event, ui ) {

$('#company').val(ui.item.company);

},

});

 

});

</script>

 

 

 

 

 

$string .= "<form method='get' action='".$GLOBALS['bloginfo_url']."/' name='searchBox' id='searchBox'>

 

 

<input placeholder='e.g. Plumbers' id='category' /> <input id='location' placeholder='e.g. Town/City' /> " ;

 

$string .= '<input placeholder="e.g. Pizza Hut" class="cocolor" id="company" name="cat">'; /*id=catsearch*/

}

}

 

$string .= '<div class="searchBtn left" onclick="document.searchBox.submit();">  </div>';

 

}

$string .= '</form>';

Link to comment
https://forums.phpfreaks.com/topic/271217-search-form/#findComment-1395371
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.