Search code examples
phphtmlcssstylesheet

use CSS div in PHP


I try to "create" a simple website. Read sth. about it some days before. I use a template, there is a style.css. I use this css for the style of my website. I try to insert a guestbook. Use this: http://www.php-einfach.de/tuts_php_gb.php I want to show each entry in a extra "content box", its a div in the CSS. Looks like the gray one on these site: ferienhaus-krueger-templin. de

I insert this in my PHP-"Script" to "

echo "<div id="content"><div class="contentbox"<h1>Von <a href=\"mailto:$zerlegen[0]\">$zerlegen[1]</a>
  am $zerlegen[2]</h1>\n
   $zerlegen[3]
   </div></div>";

Without using div it work, with the divs from the CSS it looks like this: http://marvpaul.lima-city.de/gaestebuch.php

Hope someone can help my!


Solution

  • Within PHP the speech marks " " should only be put at the start and finish of something you wish to echo, else the browser gets confused and throws an error, then all of the HTML speech marks should be replaced with singles as so:

    echo "<div id='content'><div class='contentbox'<h1>Von <a href=\'mailto:$zerlegen[0]\'\$zerlegen[1]</a>
          am $zerlegen[2]</h1>\n $zerlegen[3] </div></div>";