Oct 22, 2002 #1 aspx Programmer Jul 25, 2002 52 BG Hi! How can I obtain values of variables in JavaScript - if it's on the same php-page and use these values with PHP?
Hi! How can I obtain values of variables in JavaScript - if it's on the same php-page and use these values with PHP?
Oct 22, 2002 2 #2 Bastien Programmer May 29, 2000 1,683 CA place the js variables in a hidden form element(s) and autosubmit the form via form.submit(); hth Bastien There are many ways to skin this cat, but it still tastes like chicken Upvote 0 Downvote
place the js variables in a hidden form element(s) and autosubmit the form via form.submit(); hth Bastien There are many ways to skin this cat, but it still tastes like chicken
Oct 22, 2002 Thread starter #3 aspx Programmer Jul 25, 2002 52 BG I'm new in PHP and can you show me simple example - please! I know what you mean, but I can't imagine how to write it... Upvote 0 Downvote
I'm new in PHP and can you show me simple example - please! I know what you mean, but I can't imagine how to write it...
Oct 22, 2002 #4 Bastien Programmer May 29, 2000 1,683 CA <html><script language="javascript"> function set_var(){ forms.hiddenvar.value=3 form.submit(); } </script> <body onload="set_var()";><form action="myval.php" method='post'> <input type=hidden name='hiddenvar'> </form></body></html> <? $myvar = $_POST['hidden_var']; echo "my value = ".$myvar; ?> hth Bastien There are many ways to skin this cat, but it still tastes like chicken Upvote 0 Downvote
<html><script language="javascript"> function set_var(){ forms.hiddenvar.value=3 form.submit(); } </script> <body onload="set_var()";><form action="myval.php" method='post'> <input type=hidden name='hiddenvar'> </form></body></html> <? $myvar = $_POST['hidden_var']; echo "my value = ".$myvar; ?> hth Bastien There are many ways to skin this cat, but it still tastes like chicken
Oct 23, 2002 Thread starter #5 aspx Programmer Jul 25, 2002 52 BG Great example!! Thanx a lot!!! Upvote 0 Downvote