Pass values from JQUERY to PHP then output to INPUT in FORM

i need to get a value from the a form then send it to php using jquery then output the result a dropdown select menu

get the value of using jquery

 <input id="search" name="search" type="text">

send it to php and perform a query

  <select  id="farmertype" name="farmertype" >

         <option value="" > - PLEASE SELECT FARM -</option>

         ////   output here as options                                      

my php file farm.php

$q = ($_POST["search"]);

$db->query("SELECT * FROM farmers ");
  while ($line = $db->fetchNextObject()) {

      $idno = $line->idno;
      echo "<option value='$idno'>$idno</option>";



the jquery part is so messy this is where i really need help

$("#search").click(function() {
    search = $(this).attr('#search');
        type: 'GET',
        url: 'farm.php',
        data: "#search=" + search,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s