0

I have an error message on the URL when wrong password or captcha is added. Error looks like this on the url:

www.domain.com/signup.php?error_msg=The+characters+you+entered+did+not+match+the+word+verification

How to extract this from URL and display on the PHP file?

1 Answer 1

2

Just use the global $_GET array to retrieve the value:

echo $_GET['error_msg'];

More about this array can be found in the official documentation: http://php.net/manual/en/reserved.variables.get.php

Sign up to request clarification or add additional context in comments.

2 Comments

I solved it with this: I have no idea how to post code here... <br><br> <?php $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (strpos($url,'My+Error') !== false) { echo '<div class="error_message">' . $error_message . '</div>'; } else { echo '';} ?>
@LinasMaz You could have just checked if the value was set using the isset function like so: if (isset($_GET['error_msg'])) echo $_GET['error_msg'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.