Here is my code:
The problem is that I´m setting the id value and I dont want to do that.Code:<script language="javascript"> function show_list(){ var val = document.myform.master.options[document.myform.master.selectedIndex].value; if(val==19){ <? $sql = 'select * from table where id=19 ORDER BY id ASC'; $res = mysql_query($sql); $tot = mysql_num_rows($res); for($i=0;$i<$tot;$i++){ $r = mysql_fetch_array($res); ?> document.myform2.master.options[<?=$i?>]=new Option("<?=$r[city]?>", <?=$r[id]?>, true, false) <? } ?> } } </script>
How can I put the javascript value (val) into this php line below?
sql = 'select * from table where id=19 ORDER BY id ASC';
I´d like something like this:
sql = 'select * from table where id='+val+' ORDER BY id ASC';




Reply With Quote