Passing variables from JS to PHP
Date: 02/01/06
(PHP Community) Keywords: php, java, google
Hi -- I ran into problem passing variables from Javascript to PHP server side.
Below is the relevant fragment of the code
"angle"form name="Form1" action=""angle"?php echo $PHP_SELF ?"angle" " method="post""angle"
"angle"input type="hidden" name="latctr" /"angle"
...
"angle"/form"angle"
JS:
var center = map.getCenterLatLng(); ---- Google Maps API ----
document.Form1.latctr.value = center.y;
alert (document.Form1.latctr.value); ---- displays the value all right ----
PHP:
$latctr = $_POST['document.Form1.latctr.value'];
-- or --
$latctr = $_POST['latctr'];
neither one works ($latctr is blank).
Any hints or relevant links are appreciated. I tried to search google groups and some other forums and I don't see what I'm doing different compared to suggested solution with hidden variables and _POST method.
Source: http://community.livejournal.com/php/405768.html