- 1050 visites -

How to create an error message with php ?

The field of PHP is an area considered an outdated domain. Indeed, the lack of information written for this environment makes it difficult to grasp. Obviously, for a first introduction, it is necessary to speak directly to professionals. In this way, combine the practical and theoretical side is more advantageous.

A php form

The php development company appreciate this language for its ability to manage forms. Basically, the basic concept is that to understand that all form fields will be automatically available in the PHP script action. The principle is simple: when a visitor completes the form and clicks OK, the file is called action.php. Here is a sample of data from a form: Hello, Which translates to "Hello, John. "Apart from the htmlspecialchars parts (), this script only the obvious things. This language ensures that all HTML characters are correctly encoded to prevent HTML tags and JavaScript injections into the pages. To insert a whole number, it is possible to ask PHP to do it automatically using the filter extension.

The steps for creating the error message

It is necessary to customize its data on a website. Hence the importance of a custom validator. On a given site visitor actions are governed by certain standards like downloading a picture for example. Before creating error messages, it is necessary to establish standards to follow. To do this, it is necessary to place the validator in the / lib. When renowned folder, be careful to breakage, including uppercase and lowercase. To validate an image therefore, validate a file type and image dimensions. Then it is necessary to create options and error messages. To do this, the builder uses 2 arrays of the first concerns the rules and the second key error messages or messages. These tables are defined by the configuration set (). To add a rule or an error message, simply go through addOption () or addMessage (). To see a value in an error message, just write% size_x%. The value will be replaced when the message will be called.