Author |
Redirect with captchaZDR |
mikeyks1
Member
Posts: 7
Location: Wichita Ks
Joined: 19.10.07 |
Posted on 21-08-2013 11:48 |
|
|
How can I redirect to a new webpage after submit validation? Or is there a way to return to the top of the page after submit? I have a long form and after clicking submit i have to scroll back to the top to see the thank you message.
Edited by mikeyks1 on 22-08-2013 13:30 |
|
Author |
RE: Redirect with captchaZDR |
admin
Super Administrator
Posts: 33
Location:
Joined: 03.11.09 |
Posted on 28-08-2013 08:08 |
|
|
You have different ways to do the redirect after submit. You can add at the top of you script redirection when the captcha and the form are valid.
For example before you send any data (HTML data or headers) to the end user you can do the following:
<?php
include("class/captchaZDR.php");
$capt = new captchaZDR;
if($capt->check_result())
{
header("Location: http://www.example.com/");
}
?>
The other way is to print in the page on valid resolved captcha JavaScript redirection code.
<?php
// $_SESSION['captcha'] contain true value from captcha image, you can make COMPARISON with string entered from user. EXAMPLE:
include("class/captchaZDR.php");
$capt = new captchaZDR;
if($capt->check_result())
{
echo 'Your Input is true! :-)';
?>
<script type="text/javascript">
<!--
function redirect(){
window.location = "http://www.example.com/"
}
redirect();
//-->
</script>
<?php
}
else
{
echo 'Your Input is wrong! :-(';
}
?></b>
I hope this will help you. |
|
Author |
RE: Redirect with captchaZDR |
mikeyks1
Member
Posts: 7
Location: Wichita Ks
Joined: 19.10.07 |
Posted on 28-08-2013 11:47 |
|
|
Thanks that worked for me.
You Rock |
|