...

View Full Version : isset() with javascript



lukeurtnowski
06-11-2005, 10:07 PM
im trying to run this code once the variable ADATE is set, why is this not working?

<?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 for helping me. :thumbsup:

delinear
06-11-2005, 11:32 PM
Well, the data seems to be there, you probably need to input it in quotes though since it seems to be string data. Try:

document.date.date.value="<?php echo $result1['A_DATE']; ?>";

Really though that seems to be more of a javascript question if the PHP is doing what it's meant to. You might have more success there.

brothercake
06-11-2005, 11:36 PM
Well this is what the output of your JS looks like:


<SCRIPT TYPE="TEXT/JAVASCRIPT">
this.date.c_number.value = 1<br>
document.date.date.value = final date<br>
</SCRIPT>

The break tags are causing errors, and should the second value be a string? Or is that its name and not its value?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum