Hello all! I’m fairly new to PHP and I’m hoping you all can help with this scenario. It involves one site: Hotline.htm
The website contains a form which includes text fields, text areas, checkboxes, and dropdowns. The PHP in the file is meant to merely compile the data and send it via email.
Now, the customer wants input validation. Two text fields and one text area field are required. These fields are:
FirstName (text)
LastName (text)
QuestionSeven (textarea)
Ultimately, I’d like to be able to ensure that information is in those fields, I just haven’t found the right approach. JavaScript allows me to use pop-ups to instantly let users know, but if JavaScript is turned off on the client, it would be pointless.
I can successfully validate the data with PHP and display the error messages. However, after clicking “Submit”, all the form fields are empty. I’d love to be able to validate the initial submission, then reload the form with the error messages and the data that was submitted. I can do this with simple input text fields, but I don’t know how the set the values of textarea, checkboxes, or dropdowns.
(Form example, I just went to submit this post, and received a message notifying me of the errors, and the form appears with all my information still in it.)
Please let me know the best way to approach this scenario!
Thanks!
Toni