Javascript variable into php variable

You can do it by setting url variables or session variables.  
one way to do this is to pass the url like this

<SCRIPT LANGUAGE='JavaScript'>
<!-- //
var name="Dave";
var number=100;
document.write('<a href="another_page.php?name='+name+'&number='+number+'">another page</a>');
// -->
</SCRIPT>
from http://www.iwdp.co.uk/pfv/javascript_to_php_PFV.htm

then get the variables using php

<?php $var1 = $_GET['name']; $var2= $_GET['number']; ?>



you can do this via GET, POST, SESSION

You could do this all on the same page if you wanted to by calling a javascript function that sets these variables and then php gets them.

Comments