Hello I need some help, I want to transfer information held in a javascript variable to a php variable, how can I achieve this? Is it possible?
Printable View
Hello I need some help, I want to transfer information held in a javascript variable to a php variable, how can I achieve this? Is it possible?
You can pass them though Get, via the query string, or you can do something a little more complex and pass them though POSTCode:<script language="javascript">
var myVar = "Hello World";
window.open("page.php?myVar=" + myVar);
</script>
There might be some better ways of doing this so if your still suck your best bet would be to ask the lovely people in XML, HTML, Javascript, Web and CGICode:<form id="article">
<input type="hidden" value="" id="action"/>
</form>
<script language="javascript">
var action = document.getElementById("action");
action.value = "previewarticle";
var frm = document.getElementById("article");
frm.target = "_NEW";
frm.action = "yourpage.php";
frm.submit();
</script>