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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing an ampersand

Status
Not open for further replies.

bigbird3156

Programmer
Feb 20, 2001
183
0
0
AU
Hi... if I am passing a string variable from one page to another that contains an ampersand I get all sorts of problems...

I know there are special characters like & and & but if these values are saved in an SQL file then it still passes the ambersand and not the special charcter...

does anyone know if there is any way around this...

for example I have a designer who's name is 'Melly & Me' in my database, I want to pass this value to a page where I get to see the designers profile (and no I can't use the associated record number) ... the designer is insistant on having the ambersand in her name... is there any way around this??

The Bird from Down Under- Bigbird 3156 [upsidedown]
 
This url is generated by a cgi script that prints

Code:
print "Location: [URL unfurl="true"]http://www.castleyellow.com/byname/$catid/$s_name/$startswith/$n1-$c1/0\n\n";[/URL]

But it doesn't matter, the url is formed correctly, just the php is not grabbing the ampersand.
 
I have done both of the above but the index.php script still will not grab the ampersand character.
 
I found a workaround, it's ugly but it passes the value:

byname.cgi

Code:
$n1 =~ s/&/[AND]/g;

produces the url:

Code:
[URL unfurl="true"]http://www.castleyellow.com/byname/commercial-property-management//1/j%20%5BAND%5D%20j-/0[/URL]

which is interpreted by index.php

Code:
$n1 = str_replace("[AND]", "&", $n1);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top