how to assign javascript variable to php variable

Reply

Join Date: Mar 2008
Posts: 14
Reputation: farahphp is an unknown quantity at this point 
Solved Threads: 0
farahphp's Avatar
farahphp farahphp is offline Offline
Newbie Poster

how to assign javascript variable to php variable

 
0
  #1
Apr 4th, 2008
i want to assign the value of a java script variable to a php variable ????
can any one help me plz
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,746
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 331
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: how to assign javascript variable to php variable

 
0
  #2
Apr 4th, 2008
AFAIK, Its not possible.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 141
Reputation: meabed is on a distinguished road 
Solved Threads: 3
Team Colleague
meabed's Avatar
meabed meabed is offline Offline
Junior Poster

Re: how to assign javascript variable to php variable

 
0
  #3
Sep 18th, 2008
Actually its not possible , but you could make small trick to solve it , as i did in some projects i was working on
first i made hidden inputs in my php file , then in the javascript i getElemetbyIDvalue , and then i assign the value to the hidden input
so when i submit the form , the post variables will be my javascript vars
ill make example and post it
Real Eyes Realize Real Lies
My Resume
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 25
Reputation: mohammed2raja is an unknown quantity at this point 
Solved Threads: 1
mohammed2raja mohammed2raja is offline Offline
Light Poster

Re: how to assign javascript variable to php variable

 
0
  #4
Sep 19th, 2008
If u want to use the java script variable in php code which is reside in the same file perhaps its not possible. U write the code in separate php file, and call that file as :
window.location.href = "filename.php?Value1=" +javaScriptVariable;
and in php u can use this variable value as:
$idValue= $_GET['Value1'];
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: how to assign javascript variable to php variable

 
0
  #5
Sep 19th, 2008
Yes, just load the variable into http's GET, POST, or REQUEST arrays. It's how AJAX applications communicate with the server.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC