using Google captcha and using Jerry Kornbluth tutorial

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2017   (RSS)

Hi yea,

I was having a look/testing this tutorial, Jerry was very kind to post some time ago.....

https://www.interactivetools.com/forum/forum-posts.php?postNum=2236723#post2236723

it works great but for when submitted and then the page is refreshed I get an error

==========================================//

Notice: Undefined index: error-codes in /home/blablabla/public_html/sample-user-signup-form-with-google-robot-captcha.php on line 28 Fatal error: setPrefixedCookie: Can't set cookie(lastUrl, /user-profile.php), headers already sent! Output started in /home/blablabla/public_html/sample-user-signup-form-with-google-robot-captcha.php line 28. in /home/blablabla/public_html/blacms/lib/common.php on line 606 

==========================================//

this is my page with the captcha, it all works fine...... you can refresh the page in the unsubmitted stage and all is well...

https://goo.gl/6wnAx8

it is only once the have completed the form and submitted........ then refresh the page does the error happen.

Here is screen capture video of the event... https://goo.gl/jClc1B

if anyone knows whats wrong I would be grateful for your input.

cheers

Kenny

By ross - February 22, 2017

Hi Kenny

I am not sure exactly what the issue will be here without reviewing your code.  We can take a much closer look at everything through consulting though. 

You can email me via consulting@interactivetools.com to continue the conversation there.

As an alternative, you could modify your form so that when it successfully submits, you re-direct to a different page. That will prevent the refresh issue.  

You could even have the script re-direct to itself.  The key here is redirecting the script.

Does that make sense?

Let me know any questions.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Thank You Ross,
I managed it, 

all in all

I commented out line 63 in Jerry's code

// redirect to profile page after after signing up
//setPrefixedCookie('lastUrl', $GLOBALS['WEBSITE_LOGIN_PROFILE_URL']); // < commented this out

and just after line 131 which is,

$showSignupForm = false; // <<<<< line 131

header("Location: http://www.mydomainname.com/mysignup.php?s=123");

Here i plonked a header redir back to the page that actually the signup form is on but added this also to the url   ?s=123 but you can add anything really. 

Cheers

Kenny

By ross - February 23, 2017

Hi Kenny

Sounds good!  Glad you got a fix.

Just so you know, you don't actually even need the "=123". You could just redirect to:

header("Location: http://www.mydomainname.com/mysignup.php?");

Keep us up to date with how you are making out.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Thanks Ross
I decided to have it so s=123 so as to show the conformation of form submittance. aka

The error alerts no longer show when I have the page redirect back to itself thus, I will have an if else on the page with an alert in the likes of bla bla we sent an email etc.....

// show thanks
$errorsAndAlerts = "Thanks, We've created an account for you and emailed you your password.<br/><br/>\n";
$errorsAndAlerts .= "If you don't receive an email from us within a few minutes check your spam filter for messages from {$fromEmail}<br/><br/>\n";
$errorsAndAlerts .= "<a href='{$GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL']}'>Click here to login</a>.";

cheers and thanks for been there

kenny