Jump to content


DISPLAYING, not entering!, apostrophes?

  • Please log in to reply
2 replies to this topic

#1 Soulhunter74

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 22 October 2006 - 12:41 PM


I've got the following problem. An item in my DB has a value like this: The carpenter's roof.
With my current coding the web page only displays: The carpenter

My coding:

echo "<a href='projets_encours_details.php?ID=$row[2]'><img src='images/home/$row[0]' border='0'  class='homeThumb' alt='projet en cours' title='$row[3] $row[4] (début étude: $row[5])' width='200' height='80' /></a><br>$row[1]";

The problem seems to be with the 'title=' part. It seems like the code interprets the ' as marking the end of the string. How do I correct this?

Thanks a lot!


#2 alpine

  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 22 October 2006 - 12:58 PM

Use double quotes in your html instead of single quotes:

echo <<<_HTML
<a href="projets_encours_details.php?ID={$row[2]}"><img src="images/home/{$row[0]}" border="0" class="homeThumb" alt="projet en cours" title="{$row[3]} {$row[4]} (début étude: {$row[5]})" width="200" height="80" />< /a>{$row[1]}

// Or escape them in normal echo

echo "<a href=\"projets_encours_details.php?ID=$row[2]\"><img src=\"images/home/$row[0]\" border=\"0\"  class=\"homeThumb\" alt=\"projet en cours\" title=\"$row[3] $row[4] (début étude: $row[5])\" width=\"200\" height=\"80\" />< /a>$row[1]";


#3 sasa

  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 22 October 2006 - 01:14 PM

use htmlentities()

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users