anyone know about how to post the value from java script to php ? i use onChange () to post value.
below code was syntax error when run in browser ... but i dunno which code are error . anyone can help me ?
Thank u
<?php
echo '
<script language="JavaScript1.2">
function browse(form)
{
var site = form.supplier_id.options[form.supplier_id.selectedIndex].value;
';
$query = "Select * from member where Name='$site'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo'
form.address.value = '.$row[Address].' ;
}
</script>
';
?>
how to post value from java script to Php?
Moderator: General Moderators
javascript runs client-side, php server-side.
After the document is delivered, there is no connection between the client and the server. Neither can php access the clients HTML-DOM nor javascript php's variables and functions.
There has to be a new request to the server to transmit data back and forth.
I suggest setting the values of the form and then submitting it in the javascript-function.
After the document is delivered, there is no connection between the client and the server. Neither can php access the clients HTML-DOM nor javascript php's variables and functions.
There has to be a new request to the server to transmit data back and forth.
I suggest setting the values of the form and then submitting it in the javascript-function.