Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
43
rated 0 times [  49] [ 6]  / answers: 1 / hits: 22931  / 11 Years ago, thu, october 31, 2013, 12:00:00
if (!(isset($_POST['fullname']) && strlen($_POST['fullname']))) {
echo
<script type=text/javascript>.
window.alert('You must enter your full name.');.
</script>;

exit;
}


The above code is in the register.php file. I have html form in the index.html. when i post the form without full name. it displays alert but page gets stuck at register.php (blank page.)
i want to display the alert on index.html page or atleast get redirected to index.html.
how to do it???


More From » php

 Answers
8

Try window.location.href = '/index.html inside script



if (! (isset($_POST['fullname']) && strlen($_POST['fullname']))) {
echo <script type=text/javascript>window.alert('You must enter your full name.');window.location.href = '/index.html';</script>;
exit;
}

[#74601] Tuesday, October 29, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brendan

Total Points: 426
Total Questions: 110
Total Answers: 94

Location: Western Sahara
Member since Mon, May 3, 2021
3 Years ago
;