hi all !
i have 2 table, news and subcat (include sub_cat_id,sub_cat,catagory) , in my code there html select, which will select sub_cat from subcat table, and as i select will insert the sub_cat vars. into news table, but i need to insert also the catagory !
is there any way ?
this the select code :
<?
$sql_cat="select * from subcat";
$result_cat=@mysql_query($sql_cat,$db);
echo "<select name=\"newsub_cat\">";
while($mycat=@mysql_fetch_array($result_cat))
{
$sub_cat=$mycat["sub_cat"];
$sub_cat_id=$mycat["sub_cat_id"];
$catagory=$mycat["catagory"];
echo"<option value=\"$sub_cat\">:: $catagory ::: $sub_cat ::: $sub_cat_id ::</option>";
}
echo"</select>";
?>
and i was trying with this to view the catagory as i select the sub_cat :
<?
if($action == "add" && $addsite == "1"){
$query = mysql_query("Select catagory from subcat where subcat='$subcat'",$db);
list($sub_cat_id, $sub_cat, $catagory) = mysql_fetch_row($query);
echo "[$catagory] $newsub_cat";
?>
thx !