Help me out with my sloppy HTML/PHP -


this might sound silly question how make code seem...neater?

    echo "<h3><font face='helvetica'><font size='4'><b><font color='b80000'>$title</font></font></font></b> <font color='a0a0a0'>$category &nbsp;</font><font color='a0a0a0'><a href='profile.php?id=$userid'>$user</a></font>     <font face='helvetica'><font size='3'><br>&nbsp;$desc</font></font><br>         <h3><font color='101010'> &nbsp;$city,$state&nbsp;$zip&nbsp;<font color='a0a0a0'>$date</font>  </font></h3>"; ?> 

there's nothing wrong code looks sloppy - wondering if me out making neat , tidy

  1. don't use <font> - move rules css, can style <h3> element. also! not computers have helvetica, may want change "helvetica", arial; design stays inline intent.
  2. stay away using <h3> twice - put second h3 <p> or similar, , use css style that.
  3. &nbsp;$city,$state&nbsp;$zip&nbsp; dirty - concatenate string spaces in php, echo string.
  4. instead of using echo output php, use echo inside of html elements - make more readable.
  5. use htmlspecialchars() on every piece of data comes out of database before echo page. prevents invalid html and xss vulnerabilities.

that should tighten up!


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -