Have an account? Sign in
Login  Register  Facebook
phpmailer and recaptcha
hi

iv got phpmailer and recaptcha together but im stuck.

iv integrated recaptcha within my php form and im stuck on this part where it validates recaptcha and then if success i want it to submit the form to phpmailer, but the code i thought would work doesnt...

please see the following code

// redirect to success page 
if ($success){
 header( \'Location: ../Scripts/_lib/phpmailer-fe.php\'); 
}
else{
  print \"<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">\";
}
Started: September 16, 2011 Latest Activity: September 16, 2011 phpmailer recaptcha
3 Answers
from testing i have managed to try this
if ($validationOK){
if (isset($_POST['submit'])) {
include '../Scripts/_lib/phpmailer-fe.php';
}
else{
	header ("Location: error.html");
}
}
but this results in the recaptcha's iframe showing an error for my phpmailer so i need to somehow get
include '../Scripts/_lib/phpmailer-fe.php';
to include it in the parent window and not the recaptcha iframe.

Posted: DonaldS
In: September 16, 2011

you should add the if(isset($_POST['submit'])) before if ($validationOK)
September 16, 2011

You are quoting your string in a wrong way. Encapsulate it in single quotes:
print \'<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">\';

You should be able to find such errors with any editor that provides decent syntax highlighting (it can even be seen with the syntax highlighter in your question).
If this is the problem, I don\'t know, you don\'t give enough information. Also note that according to Wikipedia, this method is deprecated.
I don\'t know whether this solves the problem, you don\'t give enough information.
Also if you are using HTTP 1.1, the URL provided to Location must be absolute:
Note: HTTP/1.1 requires an absolute URI as argument to » Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER[\'HTTP_HOST\'], $_SERVER[\'PHP_SELF\'] and dirname() to make an absolute URI from a relative one yourself.

Posted: MacOS
In: September 16, 2011

the error.html link is incase someone misses out a field. what im trying to do is get the form to send the values to phpmailer-fe.php but only after it verifies recaptcha. but recaptcha in php is a self submitting form.
September 16, 2011

really you can use any other captcha and try...
September 16, 2011

its not working : Any errors? What is it doing? What should it do?
can you give me the $success value i mean just show me more cods

Posted: is_set
In: September 16, 2011

the form went to that file. there are config files for that php file which allow you to set which fields are required. but to run recaptcha it runs in a self submitting form. so i need to actions in 1 form but in the recaptcha form there is that part of code i posted in my first post which states if success then you are redirected to whatever page you like. But i need to submit the form to the ../Scripts/_lib/phpmailer-fe.php file
September 16, 2011

adding the php code at the Beginning of the page is prefered
September 16, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer