Hi All,
Some website said the we cannot run php function in javascript because php is on server side and javascript is on client side.
My code will help us to run a php function when you type something on the textbox given below.
<?php
function myfunction(){
$x="I love PHP by Arman de Guzman de Castro :-)!";
return $x;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function ILovePHP() {
b = "<?=myfunction();?>";
alert(b);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post"><input name="" name="" type="text" onChange="ILovePHP();"></form><p>
</body>
</html>
try this!!
cheers!!!