php - How to get a session variable work in java script function? -


it may stupid question, went through various pages since 2 days, , didn't solution myself. made session variable this:

<?php session_start();  $_session['currentpage']="home"; ?> 

(i checked, make variable , assign right.)

then tried use parameter here:

<body onload="changepage($_session['currentpage'])">

it doesn't pass variable. tried put directly function, not parameter, inside it, doesn't work either. missing here bet. can please out? thanks.

you missing php tags:

<body onload="changepage('<?php echo $_session['currentpage']; ?>')"> 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -