why does this javascript function not work? I keep getting an error. <SCRIPT TYPE="TEXT/JAVASCRIPT"> function findNum() { <?php $query1 = mysql_query("select C_NUMBER from ACTIVITY where C_NUMBER = $ADATE;") or die(mysql_error()); $result2 = mysql_fetch_array($query2) ?> document.date.c_number.value = <?php echo $result2['C_NUMBER']; ?> document.date.date.value = <?php echo $result1['A_DATE']; ?> } </SCRIPT>
Thanks
One thing is that you call $result2 which is based on $query2 which doesn't exist, and that you call $result1, which doesn't exist either
J.
What's the error?
Yeah, what he said.
Good observation J.
😃
ok, I made some modifications to it, thanks,
<?php if (isset($_GET['ADATE'])) { $result1 = mysql_fetch_array($query1); ?> <SCRIPT TYPE="TEXT/JAVASCRIPT"> document.date.c_number.value = <?php echo $result1['C_NUMBER']; ?> document.date.date.value = <?php echo $result1['A_DATE']; ?> </SCRIPT> <?php } ?> You can see it in action here (bottom form) http://www.lukesplace.com/Padilla/createreport1.php
thanks