Validating forms and links data

To show data that was sent from a link or form, we can use any of the methods we have already learned in previous chapters.

Validating forms and links data | Learn PHP | To show data that was sent from a link or form, we can use any of the methods we have already learned in previous chapters

Validations in PHP

To show data that was sent from a link or form, we can use any of the methods we have already learned in previous chapters:

Leave prepared the HTML tags inside which we will insert with echo the received variables, or have PHP generate all the data of the variables as the HTML code that wraps them.

But, waiting for a user's data to show it below, has its risks. As the arrival of these data depends on the user, many times we will find the surprise that the expected data did not arrive; that is to say, nothing guarantees to us in an infallible way that the user has provided that data that we are waiting for to be used later in the assembly of a dynamic page that shows that data.

Therefore, it is extremely important that we learn to verify:

  1. That the data has reached the server
  2. They have been sent by the means we expect. That is, we verify its origin (that have been sent using the get method, or post, depending on the case),
  3. And that its value is valid (that is not empty, that it is the type of data that we expect, that it is within the range of values allowed, etc.)

For this very common task of verifying data before using them, conditionals are used, which is the topic that we will learn next.

Did you like it or was it useful?

Help us share it in Social Networks

Professor at the University of Guadalajara

Hugo Delgado Desarrollador y Diseñador Web en Puerto Vallarta

Professional in Web Development and SEO Positioning for more than 10 continuous years.
We have more than 200 certificates and recognitions in the Academic and Professional trajectory, including diploma certificates certified by Google.

IT ALSO DESERVES TO PAY TO VISIT:

Not finding what you need?

Use our internal search to discover more information
Sponsored content:
 

Leave your Comment

SPONSOR

Your business can also appear here. More information

Recommended: