Cum Tel
Cum Tel

Reputation: 53

# tag On Php QueryString Not Working

I am facing a problem with passing query string. In my query string the value containing a # tag when i use $_REQUEST['string'] its only return the value which is write before of # tag. There is any way to solve this problem...

My Problem is

     localhost/index.php?string=adc#123

Value i get using

     $_REQUEST['string'] 

is only abc value after # tag not capture.

please suggest me solution for this problem...

Upvotes: 0

Views: 315

Answers (3)

Sougata Bose
Sougata Bose

Reputation: 31749

When redirecting to that page generate the query string like -

header('location:index.php?str='.urlencode('abc#123'));

It will encode the query string value.

Upvotes: 0

Vikas Umrao
Vikas Umrao

Reputation: 2615

use urlencode($string) before sending in php file.

Upvotes: 1

Cr3aHal0
Cr3aHal0

Reputation: 809

I assume it is because # is a reserved character which is used as an anchor to access components in your web pages, like http://example.org/index.php#header that will point to the tag which as "header" as identifier.

Did you try to escape this character or to use urlencode(...) so it won't be interpreted as an anchor? Doc : http://php.net/manual/fr/function.urlencode.php

Upvotes: 0

Related Questions