| | |
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
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access address ajax apache api array autoincrement beginner binary broken cakephp checkbox class cms code cron curl database date dehasher directory display download dynamic echo email error external file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu method methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query question radio random recursion regex remote script search server sessions shopping sms soap source space speed sql structure support! syntax system table tutorial update upload url validation validator variable video web xml youtube






