M
Matthew Salerno
I have a cgi/mod_perl script that at one point it generates url's based on
directories:
foreach (@dirs){
my $lnk = qq|<A HREF="index.cgi?List=$_&TestID=$testid" TARGET="$testid"
ONCLICK="window.open('index.cgi?List=$_&testid=$testid',
'$testid','toolbar=no,location=no,directories=no,status=no,menubar=no,scroll
bars=yes,resizable=yes, width=450,height=230,left=100,top=100'); return
false">|;
print "$lnk1 here </a><br>";
}
The problem is that some of the directories contain ampersands "&".
If there is an ampersand in the directory name, the the rest of the query
string gets all messed up.
ex.
If the directory is titled:
Paperwork_&_Cover
The URL becomes
http://testserv/index.cgi?List=Paperwork_&_Cover&testID=70821
Before the print statement, I have tried the following:
escape($lnk);
Gives me:
Software error:
/TestDocs/70822/Paperwork_ No Documents in this system No such file or
directory at /docs/index.cgi line 345.
$_ =~ s/\&/\&\;/g;
Gives me:
Software error:
/TestDocs/70822/Paperwork_ No Documents in this system No such file or
directory at /docs/index.cgi line 345.
$_ =~ s/\&/%26/g;
Gives me:
Software error:
/TestDocs/70822/Paperwork_%26_Cover No Documents in this system No such file
or directory at /docs/index.cgi line 345.
I am going nuts trying to figure out how to get this to work. Can anyone
offer up a bit of wisdom.
Thanks,
Matt
directories:
foreach (@dirs){
my $lnk = qq|<A HREF="index.cgi?List=$_&TestID=$testid" TARGET="$testid"
ONCLICK="window.open('index.cgi?List=$_&testid=$testid',
'$testid','toolbar=no,location=no,directories=no,status=no,menubar=no,scroll
bars=yes,resizable=yes, width=450,height=230,left=100,top=100'); return
false">|;
print "$lnk1 here </a><br>";
}
The problem is that some of the directories contain ampersands "&".
If there is an ampersand in the directory name, the the rest of the query
string gets all messed up.
ex.
If the directory is titled:
Paperwork_&_Cover
The URL becomes
http://testserv/index.cgi?List=Paperwork_&_Cover&testID=70821
Before the print statement, I have tried the following:
escape($lnk);
Gives me:
Software error:
/TestDocs/70822/Paperwork_ No Documents in this system No such file or
directory at /docs/index.cgi line 345.
$_ =~ s/\&/\&\;/g;
Gives me:
Software error:
/TestDocs/70822/Paperwork_ No Documents in this system No such file or
directory at /docs/index.cgi line 345.
$_ =~ s/\&/%26/g;
Gives me:
Software error:
/TestDocs/70822/Paperwork_%26_Cover No Documents in this system No such file
or directory at /docs/index.cgi line 345.
I am going nuts trying to figure out how to get this to work. Can anyone
offer up a bit of wisdom.
Thanks,
Matt