On Jul 28, 2003, "Ford, Mike [LSS]" claimed that: |> -----Original Message----- |> From: Shawn McKenzie [mailto:[EMAIL PROTECTED] |> Sent: 27 July 2003 08:36 |> |> I have some URLs in hrefs that have an &. This does not |> validate HTM4.01 |> transitional, so I want to replace them with & |> |> So I buffer the output and do a replace, but suppose there is |> already an |> & then I get & or if I have anything else like |> " then I get |> " | |Why can't you just put & in the href string? Seems like the simplest |way to me. | |Cheers! | |Mike |--------------------------------------------------------------------- |Mike Ford, Electronic Information Services Adviser,
Thus sayeth the manual, "Note: Be careful about variables that may match HTML entities. Things like &, © and £ are parsed by the browser and the actual entity is used instead of the desired variable name. This is an obvious hassle that the W3C has been telling people about for years. The reference is here: http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2 PHP supports changing the argument separator to the W3C-suggested semi-colon through the arg_separator .ini directive. Unfortunately most user agents do not send form data in this semi-colon separated format. A more portable way around this is to use & instead of & as the separator. You don't need to change PHP's arg_separator for this. Leave it as &, but simply encode your URLs using htmlentities()(urlencode($data)). Example 2. urlencode() and htmlentities() example echo '<a href="mycgi?foo=', htmlentities(urlencode($userinput)), '">'; " This is the word of PHP. Therefor, if _you_ are constructing the query strings, you can change your arg_separator (arg_separator.output, PHP_INI_ALL; arg_separator.input, PHP_INI_SYSTEM|PHP_INI_PERDIR) setting and in code, then you should be able to use & OR, change your & to something else, like ; before you send it, then change it back when you $_GET it. Jeff -- Registered Linux user #304026. "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php