Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:36:04+00:00 2026-06-06T10:36:04+00:00

Is it possible to use the die tag to link to an error site,

  • 0

Is it possible to use the “die” tag to link to an error site, instead of the text that is displayed by default?

require_once('recaptchalib.php');
$privatekey = "*******";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}

Like:

die ('error.php');

Of course this doesn’t work. But I can’t figure out how to use the die tag.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:36:06+00:00Added an answer on June 6, 2026 at 10:36 am

    die() cannot do anything other than print the passed value and stop the script, however your code already has the structure to do what you want:

    if (!$resp->is_valid) {
        header('Location: http://example.com');
        die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
            "(reCAPTCHA said: " . $resp->error . ")");
    }
    

    Note that if you’ve output anything before this code, you’ll have to use a different method to redirect as header() will not work after headers have been sent (by starting output).

    It’s worth noting that you would probably be better off changing the flow of the program if the captcha didn’t match rather than redirecting and stopping execution. If you redirect (as is) you lose all data associated with the current request, whereas if you set something like $captcha_error = true and continue the program (changing flow where appropriate based on $captcha_error), you end up with a better user experience since you’re not resetting an entire form because the captcha was wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Getting ‘undefined index’ error while trying to use $_FILE in PHP I
I would like to detect encoding of some text (using PHP). For that purpose
Possible Duplicate: How to parse and process HTML with PHP? I'm trying to use
Is it possible to use a PHP constant within a PHP function? // in
Possible Duplicate: what are the differences in die() and exit() in PHP? I am
Is it possible use mod_rewrite to resolve addresses hosted on another server? Say I
Is it possible use a MySQL query to perform this kind of check? If
I need a control having these features: It should be possible use it in
Is possible to use ArcSDE API in .NET(C#) ? http://edndoc.esri.com/arcsde/9.2/api/capi/dbconnects/dbconnects.htm Thanks
Is this possible to use Ajax.Beginform with update target inside of ajax form. like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.