RE: ampersands in href's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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>

Regards,

Murray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux