PHP Registration Form

Rating: 7
Comments: 2

PHP Registration Form

14 Sep 2017 07:29

When you login into a website or into your mail box, you are interacting with a form.

Forms are used to get input from the user and submit it to the web server for processing.

Learn PHP Registration Form using GET, POST Methods with Example and code.

<html>
 
<head>
 
<title>Registration Form</title>
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
</head>
 
<body>
 
<?php if (isset($_POST['form_submitted'])): ?> //this code is executed when the form is submitted 
 
<h2>Thank You 
 
<?php echo $_POST['firstname']; ?>
 
</h2> 
 
<p>You have been registered as <?php echo $_POST['firstname'] . ' ' . $_POST['lastname']; ?> </p> 
 
<p>Go <a href="/registration_form.php" >back</a> to the form</p> 
 
<?php else: ?> 
 
<h2>Registration Form</h2> 
 
<form action="registration_form.php" method="POST"> 
 
First name: <input type="text" name="firstname"><br> 
 
Last name: <input type="text" name="lastname"> <br> 
 
<input type="hidden" name="form_submitted" value="1"/> 
 
<input type="submit" value="Submit"> 
 
</form> 
 
<?php endif; ? > 
 
</body> 
 
</html>

View the Demo: https://www.guru99.com/php-forms-handling.html
Original URL: https://www.guru99.com/php-tutorials.html
License Info:

rating: +7+x

Add a New Comment
Copyright © 2011-2019 Icon Deposit - All rights Reserved