session variable value cannot print by ALERT

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

session variable value cannot print by ALERT

Post 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
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

print_r()

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

Cheers,
Kieran
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: session variable value cannot print by ALERT

Post 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.
Post Reply