In this section, we will create the logic of our web page in the index.php to validate the user’s input.Īdd the code below at the top of the file. Therefore, always include this function when outputting users input in your HTML. This prevents vulnerabilities like cross-site scripting attack (XSS) by replacing all harmful characters with harmless HTML entities. The htmlspecialchars function is used to change special characters into ones that HTML can understand and display properly. Note that we haven’t created these variables yet inside our PHP script so it will produce some errors if you refresh your browser. We added some PHP variables within our HTML page to echo out either the error messages or the value that was entered in the form. We are also using materializeCSS for some default styling. To learn more about PHP forms, check out this awesome article.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |