View Single Post
 
Old January 28th, 2005, 04:25 AM
ismnanie ismnanie is offline
Registered User
 
Join Date: Jan 2005
Location: klang, selangor, Malaysia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ismnanie Send a message via Yahoo to ismnanie
Default passing javascript to php by Snib

http://p2p.wrox.com/topic.asp?TOPIC_ID=12125

<?php

    $username = "Snib";

?>
...
<script language="javascript" type="text/javascript">
    var sStr = "My name is <?php echo $username ?>.";

    document.write(sStr);
</script>
...


    This code will output this text:


    ...
    My name is Snib.
    ...

-----
i thought this code will answer my question, but when i try it, i mean the whole code, the output is looks like this one:
     .....
     My name is
     .....

$username doesn't work. can anybody help me?