Hello Everyone,

I am trying to make 2 drop down boxs using data from a mysql database , the
code is attached , the problem is I  have a category and a sub category
table. The link between the two tables is the id ( ID in category table &
mid in subcat tables are the same ) . So i would like to make 2 drop down
boxes , one with the categories and the other with the the subcategories of
that specific category. I have written some code , which displays the
category just fine .. but doesnt display the subcategory :(. Kindly help me
out , My code is attached

regards

~junjun

/////////////////////////////////////////////////////////////////////// Code
Starts//////////////////////////////////////////////////////////////////

<html>

<head>

<title>Bismillah</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>

<script>

function ProcSel(title) {

SetCookie("subcat",title.value);

self.location.reload();

}

function SetCookie (name,thevalue) {

document.cookie = name + ' = ' + thevalue + ';';

}

</script>

<form name="form1" method="post" action="value.php">

<p> Subject Category:

<?PHP

include("conn.php");

$rslt = mysql_query("SELECT id, title from vu_mcats");

echo "<SELECT NAME='title' onChange='ProcSel(this)' SIZE='1'>n";

if ($cmfg=="")

if(mysql_num_rows($rslt))

$cmfg=mysql_result($rslt,0,"title");

while ($row = mysql_fetch_array($rslt)) {

echo "<OPTION VALUE='".$row['title']."'";

if ($cmfg == $row['title'])

echo " SELECTED>".$row['title']."";

else

echo ">".$row['title']."";

}

echo "</SELECT>";

?>

Choose Model:</TD>

<?PHP

$rslt = mysql_query("SELECT mid,id,title FROM vu_cats WHERE mid='$id'");

echo "<SELECT NAME='subcat' SIZE='1'>n";

while ($row = mysql_fetch_array($rslt)) {

echo "<OPTION VALUE='".$row['title']."'>".$row['title']." (".$row['id']."
VA)n";

}

echo "</SELECT>n";

?>

</p>

<p>

<input type="submit" name="Submit" value="Submit">

<input type="reset" name="Submit2" value="Reset">

</p>

</form>

<p>&nbsp;</p></body>

</html>
///////////////////End of Code//////////////////////////

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

Reply via email to