943,789 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 24175
  • PHP RSS
Apr 4th, 2008
0

how to assign javascript variable to php variable

Expand Post »
i want to assign the value of a java script variable to a php variable ????
can any one help me plz
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
farahphp is offline Offline
14 posts
since Mar 2008
Apr 4th, 2008
0

Re: how to assign javascript variable to php variable

AFAIK, Its not possible.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Sep 18th, 2008
0

Re: how to assign javascript variable to php variable

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
Team Colleague
Reputation Points: 55
Solved Threads: 3
Junior Poster
meabed is offline Offline
139 posts
since May 2004
Sep 19th, 2008
0

Re: how to assign javascript variable to php variable

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'];
Reputation Points: 10
Solved Threads: 2
Light Poster
mohammed2raja is offline Offline
30 posts
since Sep 2008
Sep 19th, 2008
0

Re: how to assign javascript variable to php variable

Yes, just load the variable into http's GET, POST, or REQUEST arrays. It's how AJAX applications communicate with the server.
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Help for Newbie! Need to create a link to larger image target _blank in PHP
Next Thread in PHP Forum Timeline: Slow loading JPEGs





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC