calling onchange() javascript event in php

From: Date: Wed, 13 Sep 2000 10:33:15 +0000
Subject: calling onchange() javascript event in php
Groups: php.general 
Request: Send a blank email to php-general+get-16535@lists.php.net to get a copy of this message
Hi guys, Iam trying to call a javascript function using onchange() event in a select tag.It gives me a javascript error which is shown below. (i,e) syntax error. <select name=item_type width=200 onchange=alert("value changed");> Iam sending the code snippet,please point out the mistakes. thanks in advance dushyanth my code: -------------------- <?php echo "<body bgcolor=#F0F3D1>"; $conn=mysql_pconnect("localhost","",""); mysql_select_db("shop",$conn); $sql=mysql_query("select item_name from item",$conn); echo "<form method=post name=form1 action=some.php>"; echo "<table>"; while($itrow=mysql_fetch_row($sql)) { echo "<tr>"; echo "<td><b>$itrow[0]</b></td>"; $query="select item_type,price from computer where item_name='$itrow[0]'"; $result=mysql_query($query,$conn); echo "<td>"; echo ( "\n<SCRIPT LANGUAGE='JavaScript' >\n" . " <!-- \n" . "<select name=item_type width=200 onchange=alert(\"value changed\");>\n" . " // --> \n" . "</SCRIPT>\n" ); while($myrow=mysql_fetch_row($result)) { echo "<option value='$myrow[0]'>$myrow[0] - Rs. $myrow[1]</option>"; } echo "</select>"; echo "</td>"; echo "</tr>"; } echo "<tr><td><input type=submit name=submit value=SUBMIT></td></tr>"; echo "</table>"; echo "</form>"; ?> __________________________________________________ Do You Yahoo!? Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/

« previous php.general (#16535) next »