In: Computer Science
Write a simple PHP script. In your script use all of the following: HTML, Javascript, and PHP.
using php script along with js and html to demonstrate usage of php script
simple.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<script>
function displayUserDetails(){
var userName =
document.getElementById("userName").value;
alert("USERNAME:"+userName+"\n This is done using
js");
}
</script>
</head>
<body>
<p>This is a simple php script with html and javascript in
it:
</p>
<?php
echo "Using php to
display<br>";
$x=5+10;
echo "sum of 5 and 10 is
:".$x;
?>
<form action="" >
<p>Enter name:<input
type="text" name="userName" id="userName"></p>
<p><input type="button"
value="click me" onclick="displayUserDetails()"></p>
</form>
</body>
</html>
Expected output: