How to transfer Java Script variable to PHP variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemel
    New Member
    • Oct 2007
    • 5

    #1

    How to transfer Java Script variable to PHP variable

    [code=html]
    <html>
    <body>
    <script type='text/javascript'>
    var net = new ActiveXObject(' WSCRIPT.Network ');
    alert(net.UserN ame);
    var username=net.Us erName;
    </script>
    </body>
    </html>
    [/code]
    This code display Login Username with javascript message.
    But i need transfer this username into PHP variable. How can i do this?

    PLZ any one Helep me.
    Last edited by ak1dnar; Oct 30 '07, 06:19 PM. Reason: Added [CODE=HTML] Tags
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Javascript is on the client side so you can put the javascript variable
    into a HTML hidden variable or some other POST variable.
    Then when the page is submitted back to the server it can be read by PHP.
    It is also possible using AJAX

    Comment

    Working...