Been battling with this all day, I have a PHP file which contains a mix of PHP and Javascript to autofil some drop down boxes. The PHP code works fine, but I can't seem to get any javascript code to run at all. Nothing.
Some extra info: The page below is called by a javascript function (using ajax to fill the drop downs)
Here's my code from the PHP File, if anyone can help, it'd be much appreciated. Thanks.
I've put in an alert box in the code, just to prove it won't work!
Code: Select all
<? $hand=$_GET['hand'];
$link = mysql_connect('xxxxxxx'); //change the configuration if required
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('xxxxxx'); //change this if required
$query="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ;
$result=mysql_query($query);
?>
<script type="text/javascript">
alert("I am an alert box!");
</script>
<? if(mysql_num_rows($result) == 1){
?>
<select name="loft" id="loft" onmouseover="getSet(this.value)">
<option selected="selected" value="#">Select Loft</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option selected="selected" value="<?=$row['loft']?>"><?=$row['loft']?></option>
<? } ?>
</select>
<? }else{ ?>
<select name="loft" id="loft" onchange="getSet(this.value)">
<option selected="selected" value="#">Select Loft</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value="<?=$row['loft']?>"><?=$row['loft']?></option>
<? } ?>
</select>
<? } ?>