PHP Form

PHP predefines the $_POST and $_GET variables to receive form information.

HTML form

Form example, form.php:

<form name="commentform" method="post" action="comment.php">
Salutation: <input type="text" name="nickname" />
<input type="submit" value="Submit" />

In the above example, the form information contains a(name) input box and the submit button. When you click the submit button, the page will form information(user input of the title) submitted to the POST comment.php file processing.

Comment.php file:

<p>Your name is: <?php echo $_POST["nickname"];?> </p>

When we output the form.php input box name: John, click the submit button, comment.php page shows:

Your name is: John

The above is a simple form of the process, PHP pre-defined $_POST and $_GET variables to receive form information

HTML form validation

When a form is used to collect input from a customer, do not assume that the customer will conform to the input as envisaged. At any time to the customer's input to do a rigorous examination.

Client Authentication

Client-side form validation is generally based on Javascript script authentication, this authentication method can effectively reduce the burden on the server, but also to prompt customers to enter the wrong place.

Server-Side Authentication

In some cases, in addition to client-side validation, may also need to server-side authentication(such as access to the database). This time in the PHP program to do a good logical validation. About server-side validation

Copyright 2014-2017 by All Rights Reserved.