| | |
how to assign javascript variable to php variable
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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

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
My Resume
•
•
Join Date: Sep 2008
Posts: 25
Reputation:
Solved Threads: 1
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'];
window.location.href = "filename.php?Value1=" +javaScriptVariable;
and in php u can use this variable value as:
$idValue= $_GET['Value1'];
![]() |
Similar Threads
- Hidden variable in php (PHP)
- Help...i think it is simple....Im Just new (PHP)
- AJAX generated <select> and FIREFOX (JavaScript / DHTML / AJAX)
- Need help with session in php..... (PHP)
- Javascript Function return value into PHP or not ?? Please help !! (JavaScript / DHTML / AJAX)
- get html element value using php (PHP)
- sign-in to checklogin help (PHP)
Other Threads in the PHP Forum
- Previous Thread: Help for Newbie! Need to create a link to larger image target _blank in PHP
- Next Thread: Slow loading JPEGs
Views: 8533 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






