Jump to content

Ajax Drop Down List Help.


herghost

Recommended Posts

I have this code on a php page, it works fine in IE but in firefox/flock the page wont refresh to show me the next option. BAsically when you select an option from the top box, a list of options appear in the next box down. See www.bromientertainment.co.uk in IE to see it working how it should!

 

/////////////////////////////////////////////////////////

// Search function

/////////////////////////////////////////////////////////

if ($page=="search") {

      

      //Unset these so view business page will work

      $_SESSION ["mnu_state"]="";

      $_SESSION ["mnu_city"]="";

      



      echo "<h2>Search Results</h2>";



      //make sure search term is entered

      if ($_POST ["search"]) {

            

            $val = $_POST ["search"];

            

            $TABLES = "coupons co,businesses b, users u, cats,contacts c, states s";

            $COND = "b.business=co.business and c.state=s.abbr and co.approved=1 and b.business=c.business and c.pri_contact<>2";

            $COND.= " and u.user=b.user and u.billing=1 and cats.cat=b.cat";

            

            $LIKES[]= "b.name like '%$val%'";

            $LIKES[]= "b.info like '%$val%'";

            $LIKES[]= "co.subtitle like '%$val%'";

            $LIKES[]= "co.title like '%$val%'";

            $LIKES[]= "cats.category like '%$val%'";

            $LIKES[]= "c.city like '%$val%'";

            $LIKES[]= "c.county like '%$val%'";

            $LIKES[]= "c.address1 like '%$val%'";

            $LIKES[]= "c.address2 like '%$val%'";

            $LIKES[]= "s.st_name like '%$val%'";

            

            ///////////////////////////////////////

            //run a search on each field above

            ///////////////////////////////////////

            foreach ($LIKES as $like) {

                  db_connect ($cfg["db_server"], $cfg["db_user"], $cfg["db_pass"], $cfg["db_database"]);

                  $sql = "select *,b.business as bus from $TABLES \n where $COND \n and $like";

                  //echo $sql . "<br>";

                  $result = db_query ($sql);

                  //put bus id and name in array

                  //$finds = array();

                  while ($row=mysql_fetch_object($result)) {

                  $finds[]=$row->bus;

                  }

                  mysql_close();

            }

 

 

Link to comment
https://forums.phpfreaks.com/topic/78076-ajax-drop-down-list-help/
Share on other sites

Sorry should have been this code:

 

      if (!$_POST ["search"]) {



      echo "<form method=post action=index.php?page=advsearch>";

      /* echo "<select name=city>";

      echo "<option value=all>All";

      $sql = "select * from states s, cities c where s.abbr='$g_state' and c.state=s.state group by c.city";

      ddb_query ($sql,  "cty_name", "cty_name",$city);

      echo "<b> City</b> &nbsp"; */

      echo "<select name=cat>";

      echo "<option value=all>All";

      $sql = "select * from cats";

      ddb_query ($sql,  "category", "cat",$category);

      echo "<b> Category</b>";

      echo "<Br><br><b>Search Term</b><Br><input type=text name=search>" ;

      echo "<Br><br><input type=submit value='Search'";     

      echo "</form>";      

      

      }

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.