I write 2 php pages, index.php & form.php, when user submit form in index.php, then form.php process and check whether email is duplicate, so I write in form.php like this
header('Content-type:text/html; charset=big5');
header("location:javascript://history.go(-1)");
echo "<Script language=JavaScript>alert('email exist!');</Script>";
if the email exist, page will return to index.php, I hope the input text box still keep what the user enter, and have a alert box in index.php to remind them the email exist,
But I try different way, but the alert box cannot be shown in index.php, I know nothing will output before header, I also try ob_start()
,
Can anyone teach me how can I check email duplication in form.php, and then just go back to index.php without refresh, also the user input still appear, also index.php can display an alert box to remind user, thank you!