var test=document.getElementById("text").innerHTML;
I want to put the javascript variable test into a php $_SESSION variable. I cannot figure out how to do it so can someone please help me?
var test=document.getElementById("text").innerHTML;
I want to put the javascript variable test into a php $_SESSION variable. I cannot figure out how to do it so can someone please help me?
Here you Go:
JS:
function saveMyValue(value) {
$.post( "path/phpPage.php", { data1: value });
}
PHP
<?php
session_start();
if (isset($_POST['data1'])) {
$_SESSION['name'] = $_POST['data1'];
}
?>