Help in two dropdown list

Can anyone tell me what i’am doing wrong…


<?php
session_start();
include_once("conn.php");
$cat=mssql_query("Select * from tblCat");


?>
<html>
<head>
</head>
<body>
<table>
	
		<?php
		echo '<tr>';
			echo '<td>Category</td>';
			echo '<td>';

			
					echo "<select name='catname' >";
					echo "<option></option>";
					while($catname=mssql_fetch_assoc($cat)){
						echo "<option value='".$catname[CatName]."'>".$catname['CatName']."</option>";
					}
			
			echo '</td>';
		echo '</tr>';
		echo '<tr>';
			echo '<td>Sub-Category</td>';
			echo '<td>';
				if($subcat=mssql_query("Select * from tblSubCat where CatName='$_POST[catname]'"))
				echo "<Select name='catname'>";
				echo "<option></option>";
				while($subcatname=mssql_fetch_assoc($subcat)){
					echo "<option value='".$subcatname[CatName]."'>".$subcatname['CatName']."</option>";
				}
		echo '</tr>';	
		?>
	

</table>
</body>
</html>

echo “<option value='”.$catname[CatName].“'>”.$catname[‘CatName’].“</option>”;

~One of these things is not like the others~
(Yes, it’s a Sesame Street kind of morning.)

Second thing is that you’ve got two select boxes with the same name.
Third thing is that your SELECT query isnt getting it’s variable. Wrap it in {}'s, or escape the string.

Thanks for the reply…

How can i populate my subcatname with the coresponding Catname.

Thanks…

Without submitting the form inbetween? AJAX javascript.

hi,

I change the things that you said but the question still remain how can i populate the subcatname with the catname.

iam reallt desperate with this.Thanks.

yup…is there a way that in can be done with out ajax or java script.

Not without submitting the form.

on different page?