+ 1
Can I use js variables in Php?
Can I use js variables in Php? For example,I want to set text from textarea tag to session by using php and copy it to another textarea tag from another page.
2 Respuestas
+ 6
You need to use ajax for that.
var xml = new XMLHttpRequest();
xml.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xml.open("POST", "textarea.php", true);
xml.send("data=" + document.getElementById("textarea").value);
textarea.php
<?php
session_start();
$_SESSION["textarea"] = $_POST["data"];
?>
untested
0
Big thanks