| | |
pass the javascript variable to php page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
you can pass the javascript variables to another page:
yourpage.php
php Syntax (Toggle Plain Text)
<script type="text/javascript"> var x="one"; window.location.href = "yourpage.php?var=" + x; </script>
yourpage.php
php Syntax (Toggle Plain Text)
$var=$_GET['var']; echo $var;
just add it to the link like this:
then:
php Syntax (Toggle Plain Text)
<script type="text/javascript"> var x="one"; var y="one"; window.location.href = "yourpage.php?var=" + x + "&var2=" + y; </script>
then:
php Syntax (Toggle Plain Text)
$var=$_GET['var']; $var2=$_GET['var2']; echo $var."<br>"; echo $var2;
Last edited by ryan_vietnow; Mar 19th, 2008 at 2:49 am.
![]() |
Similar Threads
- Passing data from forms from one page to another (JavaScript / DHTML / AJAX)
- Need to Pass Variables from form to form (JavaScript / DHTML / AJAX)
- pass the value to the text box (JavaScript / DHTML / AJAX)
- Pass Javascript variable to PHP code (PHP)
- Pass a javascript variable to PHP in the same function (JavaScript / DHTML / AJAX)
- get html element value using php (PHP)
Other Threads in the PHP Forum
- Previous Thread: Inserting data to a mysql table problems :(
- Next Thread: How can i confirm a fucntion is exec once
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





