Escape data as much as possible on output to avoid XSS and malformed HTML.
A good-looking form gives your site a professional appearance, and also and helps streamline your online communication.
Sanitization is a bit more liberal of an approach to accepting user data.
We can fall back to using these methods when there's a range of acceptable input.
It is very easy to create a form in Word Press, provided you have a fair knowledge of php, html and js. Now you have successfully created your php script which will be called in the action attribute.
Upload this php file inside the wordpress directory.
Word Press thankfully has a few helper functions we can use for most of what we'll commonly need to do: esc_html() we should use anytime our HTML element encloses a section of data we're outputting.
While there are lots of wordpress plugins available to create custom forms, most of them are not up to the task.
Check out our post on how to work with Upfront and Gravity Forms, complete with lots of GIFs so you can see how it all works.
No doubt Gravity Forms is the most popular plugin on this list.
NOTE: In the form action, I have used “../process.php” because the php file is one level above the page which contains the form.
Create a new page with a form successful submission message.