Jump to content
Larry Ullman's Book Forums

Form Validation, And Reloading The Form


Recommended Posts

I have an index.html page that has a form. I am doing the validation with Javascript, however I would also like to validate with PHP if the user has JS disabled.

 

The problem I am having is reloading the index.html page if the user didn't fill out the required fields. I am using--header('Location: index.html')-- to redirect the user back to the html form. For some reason I can't figure out how to get the error messages to display letting the user know what fields need to be completed, and it just displays an empty form.

 

Any suggestions would be much appreciated.

 

Thanks

Link to comment
Share on other sites

If that's the assignment, then you can't validate and submit back to the same form unless you put the same form in the calc.php script, which would be pointless when you can just submit to the same page to begin with.

Like Larry said though, you need a PHP file, not an HTML file, to do PHP validation.

Link to comment
Share on other sites

 Share

×
×
  • Create New...