0
<html>
<head>
<script>
function change(x)
{
var str=x;
<?php $name=?>str;
}
</script>
<?php echo $name;
</head>
<body>
<form>
<select name="customers" onchange=change('this.value')>
<option>Varma</option>
<option>Phani Varma</option>
<option>Prabhas Varma</option>
<option>Kishore Varma</option>
</select>
</form>
</body>
</html>
so when ever user change the select,the value should be passed to php & it must be echoed by php.Lots of thanks To all
4
Contributors
3
Replies
16
Views
4 Years
Discussion Span
Last Post by minitauros
0
<?php $name=?>

This piece of code will generate an error since it is not complete.

To pas a JS function value to PHP the JS function should return the value first. Then the value could either be
1. set into a form element (maybe a hidden input) and the form posted to the server or
2. sent to the server by ajax

Hope I understood the question. Could you explain more what you want to achieve, please.

Edited by broj1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.