How can I redirect from a php page to html page when the user click validate | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I redirect from a php page to html page when the user click validate

I have a form where the user enter his personal information Then I managed those values entered by the user via php And I have as well to control the way he wrote every thing in the form such as: Email should contain:@ and so on ….. But when he doesn’t respect those things I have to redirect him to the form(html) and print him a message inside the html page=form saying: This email is not valid HOW CAN I DO IT PLEASE

6th Dec 2021, 12:30 PM
Amal Gil
Amal Gil - avatar
1 Answer
+ 3
you don't have to redirect him, you can just add a pattern with a regex to your HTML input like so: <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$ title="the current email is not valid">
8th Dec 2021, 10:17 AM
Kruszyn