problem in fetching value

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

problem in fetching value

Post by itsmani1 »

Code: Select all

<select name="category" id="category" onChange="Fxn();">
            <?PHP
  $Qry = "Select * from category where Parent='0' order by Cname";
  $Res = mysql_db_query($db,$Qry,$cid);
	  $Num = mysql_num_rows($Res);
	  if($Num > 0)&#123;
 		while($Row = mysql_fetch_object($Res))&#123;
		$Cid = $Row -> CategoryID ;
		$Cname =$Row -> Cname ;
		$Parent = $Row -> Parent;
		  ?>
                  <option value="<?=$Cid?>"> 
                  <?=$Cname?>
                  </option>
                  <?PHP
			&#125;
		&#125;
		?>
                </select>

<script language="JavaScript" type="text/javascript">
function Fxn()&#123;
&#1111;b]var temp = document.form1.category.value;&#1111;/b]
alert (temp);
window.location.replace("addnewproduct.php?category=" + temp);
temp;
&#125;
</script>
var temp = document.form1.category.value;
problem is that i m not able to fetch the value by above stmt.
can any do it for me?

Regards.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

var obj = document.forms&#1111;x].elements&#1111;'category'];
var temp = obj&#1111;obj.selectedIndex].value;

Moved to Client Side :roll:
Post Reply