Quantcast
Viewing all articles
Browse latest Browse all 11

Form

Hi everyone!
Today we will learn how to make a simple form in PHP.

Here is an example of a form with two input fields (Written as HTML):

<html>
<body>

<form action=”welcome.php” method=”post”>
Name: <input type=”text” name=”name”><br>
E-mail: <input type=”text” name=”email”><br>
<input type=”submit”>
</form>

</body>
</html>

Now, welcome.php will have to look something like this:

<html>
<body>

Welcome <?php echo $_POST[“name”]; ?><br>
Your email address is: <?php echo $_POST[“email”]; ?>

</body>
</html>

With this information the output will be something that looks like this:

Welcome Sarah
Your email address is Sarah@example.com

Good luck practicing forms!
Have a good one, see you next time!


Viewing all articles
Browse latest Browse all 11

Trending Articles