Jump to content

Query parms with & in them


Go to solution Solved by kicken,

Recommended Posts

I have never had to deal with this so I'm a bit lost.

I have a php script that needs to send an anchor tag that looks like:

members_by_age_rpt.php?range=25%20&%20Under

With PHP the problem is I don't know what I have to do to the 'range' value to make it recognizable.  Tried html_entity_decode but that doesn't seem to be the proper treatment.  So what is it I have to do to end up with a proper 'range' value/string of "25 & Under"?

Link to comment
https://forums.phpfreaks.com/topic/315869-query-parms-with-in-them/
Share on other sites

Don't know why the site created a second topic of this item.  There is some kind of change that asks one to supply an answer to recognize solutions that I never saw before.  Must me that.  And for all I know there may be another.

OK - this is what I attempted.

$url_qry = urlencode($c);
echo "c is $c and url_qry is now $url_qry<br>";

Then I output my html with 

echo "<a href='members_by_age_rpt.php?range=$url_qry'>$c</a>";

but what does my receiving script have to do to interpret that range value now?

http://xxx.com/tools/members_by_age_rpt.php?range=25+%26+Under

This is what comes in.

Then I must have done something wrong when I used urlencode as well?

Never had to do anything like this before cause I never had a parms with an & in them before.  It's quite possible I did something wrong but it all ended up just fine.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.