You are here: Re: [PHP] ampersands in href's « PHP « IT news, forums, messages
Re: [PHP] ampersands in href's

Posted by Jack Jackson on 06/04/05 17:46

Murray @ PlanetThoughtful wrote:
>>If I want to make a link to a URL which includes some GETs can I just do:
>>
>><a href='{$_SERVER['PHP_SELF']}?p={$p}&c={$s}' ... etc etc
>>
>>or must I escape the ampersand somehow?
>
>
> Depends very much on the document type of your page. Valid XHTML
> (transitional, at least), for example, doesn't like single ampersands in <a
> href=> links. For XHTML, you need to replace "&"s with "&amp;"s.
>
> So the following link:
>
> <a href='http://www.somewhere.com/index.php?id1=1&id2=2'>Something</a>
>
> ...should be changed to:
>
> <a href='http://www.somewhere.com/index.php?id=1&amp;id=2'>Something</a>

Thank you Murray. The page is in xhtml 1.0/transitional. That was
precisely what I was worried about. The &amp; will be converted as part
of the URL right? I mean, the printed URL resulting from clicking on
that link won't say &amp; it'll just say & is this correct? Combined
with Rory's post this is really, really useful stuff and I thank you !

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация