i want to assign the value of a java script variable to a php variable ????
can any one help me plz

Recommended Answers

AFAIK, Its not possible.

Jump to Post

All 4 Replies

AFAIK, Its not possible.

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 :)

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;

Yes, just load the variable into http's GET, POST, or REQUEST arrays. It's how AJAX applications communicate with the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.