Create Form For Entering Two Numbers
(swap.html)
<!DOCTYPE html>
<html>
<form method="POST" action="swap.php">
Enter first number:<input type="text" name="n1">
Enter second number:<input type="text" name="n2">
<input type="submit">
</form>
</html>
Embed Php File Into Form Tag
(swap.php)
<?php
$a=$_POST["n1"];
$b=$_POST["n2"];
function swap($x,$y) {
$t=$x;
$x=$y;
$y=$t;
echo $x,"\n";
echo $y;
}
swap($a,$b);
?>
Comments
Post a Comment