In javascript create a simple program that calls a php scrip
In javascript create a simple program that calls a php script. Create this php script to connect to a dummy database on a local machine
Solution
Below script contains php script, which when executed, displays a button.. Click the button to display the hello message..
<html>
<body>
<script type=\"text/javascript\">
function on_callphp()
{
var result=\"<?php php_func();?>\";
alert(result);
return false;
}
</script>
<form action=\"\" method=:POST\">
<input type=\"button\" value=\"Hit me\" onclick=\"on_callphp()\"/>
</form>
<?php>
function php_func()
{
echo \"Hello\";
}
?>
</body>
</html>
