I'm wondering if there's a way to bring a variable from JS to PHP. I've got creating the variable in JS, I just wanna know if there's a way to bring it to PHP. HTML:
<form id="form" onsubmit="return false;">
<input class="mainwrite" id="userInput">
<input type="submit" onclick="save()">
</form>
JS:
function save() {
var input = document.getElementById("userInput").value;
alert(input);
}
I want to take the input
variable and add it to a PHP file as a string.