php - Title tag not displaying as expected
895
I try to style the rows with a CSS class. Now the MySQL data appears on the page, and not in the title tag anymore.
Where is the mistake?
<a href="" title="
<?php
$abfrage = "SELECT * FROM tester";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
?>
<p><span class="qtip-big"><?php echo $row->Name; ?></span></p>
<p><?php echo $row->Beschreibung; ?></p>
<?php
}
?>
">Testlink</a>
The text appears on the page and not inside of the tooltip.
Answer
Solution:
Your html is all wrong :) Your code does something like this:
Html element are not allowed in attributes (title is an attribute, so is href / src/ alt etc)
To get multiple lines, you can do this:
I've added
\n
which is a character for newline. Also not that 'line2' is directly attached. Though this looks stupid, it prevents a whitespace bevore 'line2'If you have htmlerrors, you should try an html-validator, this will return the errors you have in html
Answer
Solution:
Remove the paragraph tags from your title attribute.
Answer
Solution:
first off all you should not put HTML tags inside the title. Second of all why are you putting the php scripts inside there in such a messed up way. It reduces readability. Grab the SQL contents before you put it in the title.
Hope this helps.
Answer
Solution:
Answer
Solution:
You must escapse the contents of your html attributes. Easiest way it to use urlencode.
It's worth noting as well that html is not natively going to render within a title attribute and you must use a javascript tool tip library to get this to work as you are envisioning.