PHP Forms Introduction | Tutorial

Pubblicato il: 09 maggio 2019
sul canale di: YouAccel
4
0

Course Title: Web Development Masterclass
Course Link: http://youaccel.com/admin/cdisplay.ph...

Facebook:   / youaccel  
Twitter:   / youaccel  
Website: http://youaccel.com

Tutorial Content:

In the next part of the course we are going to be discussing how to process HTML form data using PHP. The concepts explored here are very important because web pages interact with users using Forms.

Form data can be used for many things.

We can insert form data into a Database.
We can email form data to our users, such as a confirmation email or a thank you note.
We can also use form data to perform arithmetic, or perhaps a combination of any of these purposes.
Form processing starts as soon as we fill out an HTML form and click the submit button.

At this stage in the course you should be familiar with creating HTML forms. We know that the form element, has an action attribute.

In our html course, we did just about everything, except assign a value to our action attribute. It's the action that brings our form to life.

The action of our form will point to a PHP script. In addition to instructing our server on what to do with the form data, the PHP script can also validate the form. This means, we can check things like email addresses or phone numbers to make sure they are in the right format. We can also check to make sure that form inputs are not left empty, or put limits on how much data can be inputted. These are just a few examples.

PHP form validation is done on the server, meaning it is the most effective form of validation available. We did some JavaScript validation in the JavaScript course, but we also pointed out that JavaScript can be turned off by the user.

PHP validation cannot be turned off, making it the safest way to test form inputs for data accuracy.

We will be exploring two ways to transmit form data to our PHP script from our HTML form. The Get method and Post method.

In both methods, the data is transmitted in an array that is automatically generated. The array holds the key/value pairs. The keys are the name of the form controls and the value is the data inputted by the user. We will come back to this when we start creating our form.

There are some important points to note about POST vs. GET before we begin:

The GET method passes our array variables through the URL parameters
Should be used only for sending non-sensitive data
Never send passwords through the GET method.
All variables are displayed openly in the URL.
The GET method has limits on how much information can be sent.
The current limit is 2000 characters.
The POST method passes variables using the HTTP POST method.

The POST method is much more secure because variables are not displayed in the URL
Information is invisible to others because it is embedded within the body of the HTTP request.
It has no limits as to the amount of information we can send.
This method is preferred by developers


In questa pagina del sito puoi guardare il video online PHP Forms Introduction | Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato YouAccel 09 maggio 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 4 volte e gli è piaciuto 0 spettatori. Buona visione!