Forum Moderators: open

Message Too Old, No Replies

Ampersands in links...

xhtml compliancy breaks apple.php?foo=1&bar=3

         

lunarboy1

12:26 am on May 4, 2004 (gmt 0)

10+ Year Member



<a href="apple.php?foo=1&bar=3>asdf</a> gives validator errors, but using &amp; or &#38; entities for the ampersand the variables don't seem to exist to my php. What's going on? How can I fix this and get compliancy?

DrDoc

1:04 am on May 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Seems like you've missed the closing quote ;)

<a href="apple.php?foo=1&amp;bar=3">asdf</a>

lunarboy1

5:05 pm on May 4, 2004 (gmt 0)

10+ Year Member



okay, typo on the original post, my fault. But still, when I click the link containing &amp; in IE 6.0 or Mozilla 1.6, the link works, but the variables don't seem to parse correctly, almost as if they weren't even there to begin with.

coopster

5:11 pm on May 4, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Perhaps you need to urlencode [php.net] the variables in your query string?

DrDoc

8:06 pm on May 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



&amp; should work...
The browser translates it to & before sending the query string, so the problem must be something else. Unless, of course, the query string is not submitted by a browser :)

lunarboy1

8:32 pm on May 4, 2004 (gmt 0)

10+ Year Member



okay, sorry about this, but i was having the most frustrating time with this and now i don't know why it works, but it does with the &amp;. I tried it hundreds of times before, but somehow it's working now. I fixed a minor error in my php and urlencode will help out a lot in the future.

I heard many people were having problems with this before and I probably didn't look into it as much as I should have at the beginning, sorry.

Brian