FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » java script to php (Transfer variable value from java script to php in a php file)
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
java script to php [message #159578] Thu, 11 June 2009 12:42 Go to next message
aajkaal is currently offline  aajkaal   United States
Messages: 2
Registered: June 2009
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
1 <script language='javascript'>
2 var strUsername;
3 var objNetwork;
4 objNetwork= new ActiveXObject("WScript.Network");
5 strUsername= objNetwork.Username;
6 strUsername= strUsername.toLowerCase();
7 document.write(strUsername);
8 </script>";
9
10 <?php
11
12 echo $strUsername;
I want to use strUsername (not just display) in the php code. How can I accomplish it


Regards,
aajkaal
Re: java script to php [message #159579 is a reply to message #159578] Thu, 11 June 2009 13:17 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Add to JavaScript part:

window.location.href = "http://your.domain.com/script.php?strUsername=" + strUsername;

Add to PHP part:

echo "strUsername = ".$_GET['strUsername'];
Re: java script to php [message #159581 is a reply to message #159579] Thu, 11 June 2009 13:38 Go to previous message
aajkaal is currently offline  aajkaal   United States
Messages: 2
Registered: June 2009
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
All the above code is inside one php file. So ...

Regards,
aajkaal
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Undefined index
Next Topic: Preg replace problem (again!)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Oct 20 12:25:58 EDT 2017

Total time taken to generate the page: 0.00846 seconds