Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ampersand in address line

Status
Not open for further replies.

jdmartin74

Programmer
Sep 13, 2002
45
0
0
US
I need to pass an ampersand character on an address line as part of a value. I realise obviously that the ampersand character breaks each field on the address line when used with the GET variable; which is exactly my problem. Does anyone know how a field value on a GET line can contain an ampersand character and not identify a break?

My only idea is to convert this character first and then put it back again.
 
Prior to passing the string, utilize the urlencode() function.
After passing the string, utilize the urldecode() function.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Use %26 instead.

On my machine is a file named "show_get.php", which consists of :

<?php
print '<pre>';
print_r ($_GET);
?>

When I point to that script in my browser as:

[ignore][/ignore

then

Array
(
[foo] => Mom&Pop
)

is returned


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks very much. I knew there was an easy way. I just couldn't find it for looking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top