Catch an Error on html with php -
currently i'm developing website in class in university. i'm using php , mysql.
i have signup page when submitted goes auxiliary php page goes through number of conditions , i'f form failed in 1 of conditions wanted return signup page appeared line detailing error.
i wanted know if need use php or php+javascript.
thanks in advance.
to points use both!
add jquery validate plugin form. display real time errors user. can't totally rely on method though because if user switches off js validation wornt work ;)
in php run through validation checks , if 1 fails use header (as phpnutt mention above) wouldn't recommend passing error message in url can unprofessional. instead number, check number on signup page. if it's there then display error.
// auxiliary php page if (conditon met) { } else { header("location: /signup_page.php?error=1"); exit; } // signup page if(isset($_get['error']) && $_get['error']==1) { echo "<h3>form failed, please try again</h3>"; }
Comments
Post a Comment