Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

reCaptcha problems

Featured Replies

Hello all,

 

I have setup recaptcha on my form and am having a few problems.

 

My form layout is as follows -

 

Form.php - page containing form fields and reCaptcha - source code is below -

 

<?php

require_once('recaptchalib.php');

$publickey = "XXXXXXXXXXXXXXXXXXXXXXXXX"; // you got this from the signup page

echo recaptcha_get_html($publickey);

 

# the response from reCAPTCHA

$resp = null;

# the error code from reCAPTCHA, if any

$error = null;

 

# are we submitting the page?

if ($_POST["submit"]) {

$resp = recaptcha_check_answer ($privatekey,

$_SERVER["REMOTE_ADDR"],

$_POST["recaptcha_challenge_field"],

$_POST["recaptcha_response_field"]);

 

if ($resp->is_valid) {

echo "You got it!";

# in a real application, you should send an email, create an account, etc

} else {

# set the error code so that we can display it. You could also use

# die ("reCAPTCHA failed"), but using the error message is

# more user friendly

$error = $resp->error;

}

}

echo recaptcha_get_html($publickey, $error);

?>

----------------------------------------------------------------------------------------------------

 

Process.php - page containing mail intructions as well as redirect if recaptcha was a success.

 

<?php

 

require_once('recaptchalib.php');

$privatekey = "XXXXXXXXXXXXXXXXXXX";

$resp = recaptcha_check_answer ($privatekey,

$_SERVER["REMOTE_ADDR"],

$_POST["recaptcha_challenge_field"],

$_POST["recaptcha_response_field"]);

if(!$resp->is_valid) {

header("location:newsletter-success.php");

die();

}

 

else if($resp->is_valid) {

header("location:newsletter-error.php");

}

 

 

 

mail( "XXXXXXXXXXXXXX", "Newsletter Sign Up",

"\nEnquiry From: - $name

\nPostcode: - $postcode

\nTelephone Number: - $telno

\nEMAIL ADDRESS:- $email

\nFurther Detail:- $furtherdetails

\nPrefered Contact Time:- $contacttime

\nInterested in the following newsletter/s:- $newsletters",

"From: NewsLetterService@XXXXXXXXXXXXXX" );

 

?>

 

------------------------------------------------------------------------------------------

 

 

Success.php - reCapthcha and information sent ok!

 

Error.php - reCaptcha error page with back function to re-enter reCaptcha code.

 

 

The form sends, and directs to the process.php form page, just stays there, it doesn't then re-direct to the success or error page?

 

Please help,

 

Regards

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.