let’s say i have an input form, wherein, it’s use for an email address. this form is part of a long form so i use an alert box instead when other inputs got errors….my question now is, if I checked the email input string via php, if it has been taken , how will I put the message like e.g “this email has been taken” in an alert box if i am using PHP to check it from backend ?..i want an alert box, since I use it with the other input boxes that don’t need a backend check
e.g
alert("$errormessage");
You can echo any kind of javascript with PHP. The question is however, are you sure you want to do this? You can also do like this:
But you could also use jQuery and Ajax requests to check if email exists with ajax when user has typed the email.