0

I have a url like http://localhost/uploaded_server_alert/backup/alertR/business/business-registration.php?back_abn=2342&back_add1=#asdas

I want to fetch the back_add1 value in my page. But if I use $_REQUEST['back_add1'] then it is not working. Please help me how to fetch the data.

3 Answers 3

2

You need to encode the character # as %23, try like this

http://localhost/uploaded_server_alert/backup/alertR/business/business-registration.php?back_abn=2342&back_add1=%23asdas
Sign up to request clarification or add additional context in comments.

Comments

0

Edit: try urlencode() to encode the URL, and then fetch its value.

4 Comments

Your code is equal to the questioner's one in this case. $_GET will only see parameters sent via URL, $_REQUEST handles both, $_POST and $_GET.
then please suggest how to do that?
urlencode($foo) where $foo='#asdas php.net/manual/en/function.urlencode.php
do that where you form your URL.
0

You're getting a blank result because of the #. # is an anchor tag. If you have an element in your page with name asdas, the page will scroll down there.

2 Comments

then is there any change to get "#asdas" into variable.
Not with PHP. With Javascript you can get it by doing window.location.hash. Make the link without the hash. If needed, you can manually add it afterwards in PHP.

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.