View Full Version : Javascript in php

02-19-2008, 10:47 PM
Hi, my chat script uses javascript, but when I want to display the name I want to use the name of the person logged in...
But how do I put something like


Where it says THIS IS THE NAME

param += '&name=THIS IS THE NAME';

Now I don't know if this is possible, because PHP is server-side and Javascript is client-side.

Any Ideas?

02-19-2008, 10:49 PM

param += '&name= <?php echo $_SESSION["username"]; ?>';

Javascript has no idea and doesn't care if PHP wrote that value in.

02-19-2008, 11:12 PM
Oh, ok, I swear I tried that... :D

Thankyou :)

02-20-2008, 12:13 AM
you may also use the less code intensive option of:



02-20-2008, 01:31 AM
only if short tags is allowed.

02-20-2008, 01:52 PM
Yeah I actually had the short tag version then changed it as to not make the assumption that he had short tags turned on. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum