How would you Create a form with fields for \"Email Address\" and \"Confirm Emai
ID: 3673225 • Letter: H
Question
How would you Create a form with fields for "Email Address" and "Confirm Email Address". Write PHP code that validates that both fields are filled in, both fields match, and that: 1) the values in the fields are such that there is exactly one "@" in the fields, 2) that the "@" is not the first character, 3) that there is a "." in the field that appears at least one character after the "@", and 4) there are at least two characters after the last "." . If the form data is invalid, show a relevant message to the user and allow them to fix the data.
Explanation / Answer
function confirmEmail() { var email = document.getElementById("email").value var confemail = document.getElementById("confemail").value if(email != confemail) { alert('Email Not Matching!'); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.