Page 1 of 1

session variable value cannot print by ALERT

Posted: Wed Dec 20, 2006 1:30 am
by eshban
Can i print SESSION VARIBLE through JAVASCRIPT ALERT
i use this code

Code: Select all

$_SESSION['abc']  = 'aaaa';
$rr = $_SESSION['abc'];

Code: Select all

<script>alert(<?php $rr;?>)</script> 
But it does not display anything

Posted: Wed Dec 20, 2006 1:41 am
by Kieran Huggins
print_r()

Maybe you should try a PHP tutorial somewhere. Anyone know of a good one?

Cheers,
Kieran

Re: session variable value cannot print by ALERT

Posted: Wed Dec 20, 2006 2:27 am
by onion2k
eshban wrote:

Code: Select all

<script>alert(<?php $rr;?>)</script> 
But it does not display anything
It'd work if you had <?php echo $rr;?> in there.