I have two pages. One that accepts input and stores it to a javascript variable. The other will receive the sent variable and store it to php variable so that i can forward it to the database.
here's the code of my first page:
<html>
<head>
<script type="text/javascript">
var pricee= 0;
var quants;
function queue(num,str){
this.pricee=num;
this.quants=str;
alert(num+" "+str);
}
function alertCurrentNumandStr(){
alert("This is the latest: "+this.pricee+" "+this.quants);
}
function send(num){
this.pricee=num;
}
</script>
</head>
<body>
<ul>
<li><script type="text/javascript">var x=42, y="alive";</script><a href="#" onclick="queue(x, y);">42 Alive</a></li>
<li><a href="#" onclick="alertCurrentNumandStr();">Get</a></li>
<li><script type="text/javascript">var t=10;</script><a href="#" onclick="send(t);">Submit</a></li>
<!--How to send this.pricee, this.quants to .php when clicking the Submit link(above)?-->
</ul>
</body>
</html>
And code on my secondpage:
<html>
<head>
<?php
$testNum= $_GET['pricee']
?>
</head>
<body>
<?php
echo "<h1>The num value </h1>";
echo $testNum;
?>
</body>
</html>
How can I pass the javascript variables to the second page when I click Submit?