Passing variable with slashes in URL
| From: | Claudia Smith | Date: | Wed, 16 May 2001 21:15:36 +0000 |
| Subject: | Passing variable with slashes in URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53104@lists.php.net to get a copy of this message | ||
Currently I have a problem with IE. The IE browser will not bring up my
encoded url. When clicking on the link I either receive a script error or
nothing happens. The issue is with the double quotes. IE does not recognized
the encoded character %22 for quotes. IE does seem to process single quotes
(%27) OK.
Here is my code to encode the string variable and create the link
The string I am having problems with = "All Inclusive" Casa De Campo Golf =
$headline
$url_title = rawurlencode( $headline );
print "<tr><td align = 'left'><font face='arial'
size='2'><a
href='javascript:openQuote(\"$main_url/miniquote_form.inc.php3?site=$site&ad
=$ad&header=$url_title\", \"helpWin\");'>Contact us for
information</a></font>";
Here is what the url looks like in the Netscape browser window
header=%22All%20Inclusive%22%20Casa%20De%20Campo%20Golf
If I include this code:
$headline = addslashes ($headline);
before the:
$url_title = rawurlencode( $headline );
IE now processes the url link and the string displays correctly for me in my
popup window.
Here is the IE url:
header="All%20Inclusive"%20Casa%20De%20Campo%20Golf
However -- NS now displays the string with backslahes.
Here is the comparable NS url:
header=%5C%22All%20Inclusive%5C%22%20Casa%20De%20Campo%20Golf
Here is the code in my form to display the header variable (which I thought
would strip out the slashes)
<?php
$headertitle = stripslashes( $header );
print "$headertitle"; ?>
I have tried htmlentities as:
$url_title = htmlentites( $headline ); and neither IE nor Netscape would
work -- the url link would not work. perhaps my syntax is incorrect for
this function?
Claudia