I am currently learning PHP, so I am just playing around with it. I got to function and decided to write this on my own.
I want to take input from the user and pass it on to my defined function.
Kindly see my codes below, it works but I feel something might be missing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<form action="user defined function.php" method="post">
<input type="text" name="name"> <br>
<input type="number" name="age"> <br>
<button type="submit">Submit </button>
</form>
<?php
function myName($name, $age)
{
echo "My is " . $_POST["name"] . ", and I am " . $_POST["age"] . " years old.";
}
myName ("", 0);
?>
</body>
</html>
Top comments (1)