| | |
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 |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend






