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.
Your html is all wrong :) Your code does something like this:
<a title="<p>paragraph</p>" > anchor </a>
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:
<a title="Line1
line2" > anchor </a>
I've added 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
Remove the paragraph tags from your title attribute.
You must escapse the contents of your html attributes. Easiest way it to use urlencode.
echo urlencode("<p>".$row->Name."</p><p>".$row->Beschreibung."</p>");
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.
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.
<?php
$abfrage = "SELECT * FROM tester";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis)){
$name=$row->name;
$Bech=$row->Beschreibung;
}
?>
<a href="" title="<?=$name?> <?=$Bech?>">Test Link</a>
Hope this helps.
<?php
$abfrage = "SELECT * FROM tester";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_array($ergebnis))
{
$Name=$row['Name'];
$Beschreibung=$row['Beschreibung'];
}
<a href='link' title='<? echo $Name?> <? echo $Beschreibung?>'>link</a>