?
Solved

unescaped & or unknown entity "&..."

Posted on 2006-11-28
3
Medium Priority
?
586 Views
Last Modified: 2006-12-20
Hi,

If I'm using a php / mysql / databse program & have URLs that contain lots of ampersands, is there any way to get this to be considered not an error.  Is it an error?  Using Firefox's code checker I see

unescaped & or unknown entity "&..."

Thanks!!

Ubee...
0
Comment
Question by:a466-ub52
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Expert Comment

by:Steggs
ID: 18028536
Replace & with &
0
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 1600 total points
ID: 18028743
ANYWHERE in an HTML page you have an & it must be written as &

Thus the following varieties of HTML are all correct:
<a href="useful.php?foo=1&amp;bar=2">Ampersand-tastic!</a>
<input type="text" value="Hello &amp; Goodbye" />
<p>"You &amp; I" is more correct than "I &amp; You"</p>


Of course, when actually typing a URL into the address bar of your browser, that's not HTML.  A regular & is correct.  It's just that the browser when interpreting any chunk of HTML will treat & as the beginning of an HTML entity, so you've got to spell it all out.

Now, since you've said you're using PHP and MySQL I imagine you're selecting these data from the database, in which case all you really need to do to make sure it's correct is call htmlentities():

Instead of   echo $string;   you'd do   echo htmlentities($string);   and PHP will do all the conversions for you (including quote marks and other stuff that can screw up a page)


0
 

Author Comment

by:a466-ub52
ID: 18174563
Wow!!  Thanks... :) : )
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question