View Full Version : isset() with javascript

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

if (isset($_GET['ADATE'])) {
$result1 = mysql_fetch_array($query1);
document.date.c_number.value = <?php echo $result1['C_NUMBER']; ?>
document.date.date.value = <?php echo $result1['A_DATE']; ?>
You can see it in action here (bottom form)

thanks for helping me. :thumbsup:

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.

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

this.date.c_number.value = 1<br>
document.date.date.value = final date<br>

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