cascading select

cascading select

am 14.07.2011 17:39:33 von Chris Stinemetz

I am trying to create a cascading seletct with 3 menu choices.
For some reason my third select menu is not populating. It does not
seem like my ajax is correctly sending $_post values to the final
query in my PHP class I built.
By the time I make it to the final (third) select menu there are no choices.

Hopefully someone can find something I missed in the following code snippits.

Any help is greatly appreciated.

Please excuse the incorrect indentions. For some reason gmail changes it.

Thanks,

Chris

ajax code...




php class for populating select menus....

class SelectList
{
protected $conn;
public function __construct()
{
$this->DbConnect();
}
protected function DbConnect()
{
include "db_config.php";
$this->conn =
mysql_connect($host,$user,$password) OR die("Unable to connect to the
database");
mysql_select_db($db,$this->conn) OR die("can
not select the database $db");
return TRUE;
}
public function ShowMarket()
{
$sql = "SELECT DISTINCT id_markets FROM store_list";
$res = mysql_query($sql,$this->conn);
$market = '';
while($row = mysql_fetch_array($res))
{
$market .= '';
}
return $market;
}

public function ShowType()
{
$sql = "SELECT DISTINCT store_type FROM store_list";
$res = mysql_query($sql,$this->conn);
$type = '';
while($row = mysql_fetch_array($res))
{
$type .= '';
}
return $type;
}

public function ShowStore()
{
$sql = "SELECT store_name FROM store_list WHERE
id_markets=$_POST[id] AND store_type=$_POST[id]";
$res = mysql_query($sql,$this->conn);
$Store = '';
while($row = mysql_fetch_array($res))
{
$Store .= '';
}
return $Store;
}
}

$opt = new SelectList();

?>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php