Hi,

I'm trying passing a javascript variable into a php variable.

After make some search i realize that was not so easy, and i only found that was possible with AJAX. I never use AJAX, so any one have some simple example in AJAX or other way that i can pass a javascript variable into a php.

My code example:

<script type="text/javascript">
function inputBox(message) {
	document.getElementById("inputbox").value = message;
}
</script>

<input id="inputbox" type="text">

<?php echo $valueFromJSvar;?>
...

<input type="button" name="<?=trim($line);?>" value="Delete" class="form" onClick="inputBox(this.name);">

Cheers

    Write a Reply...