Php Script To Display area of square



Create Form Page

(square.html)

<!DOCTYPE html>
<html>
<body>
<form action="squ.php" method="POST">
Enter sides:<input type="number" name="n1"><br>

<input type="submit" value="submit">
</form>
</body>
</html>

Output

Embed Php File Into Form Tag

(squ.php)

<?php

$s=$_POST["n1"];

$squ=$s*$s;
echo "<h1>Area of square is:$squ</h1>";
?>

Output



Comments