0

Is it possible to pass the javascript varible from one php page to another php page. what is the syntax we use.

2
Contributors
4
Replies
12
Views
9 Years
Discussion Span
Last Post by kings
0

you can pass the javascript variables to another page:

<script type="text/javascript">
var x="one";
window.location.href = "yourpage.php?var=" + x;
</script>

yourpage.php

$var=$_GET['var'];
echo $var;
0

thanks for the above code how to pass more than one variable to the same page using the single link

0

just add it to the link like this:

<script type="text/javascript">
    var x="one";
    var y="one";
window.location.href = "yourpage.php?var=" + x + "&var2=" + y;

      </script>

then:

$var=$_GET['var'];
   $var2=$_GET['var2'];
      
    echo $var."<br>";
   echo $var2;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.