Make PHP echo out the html in clean format

Hi,

This might be a very simple question but I am not sure how to use PHP to echo out html in a very clean format.
Every time I use php to print out html element, I get sth like:
<div class="usercontent" style="display:block;">  
               <div id="dcdiv" style="background-color:#f3f3f3;  " ><form method="post" action="./../processrequest.php"><input type="hidden" id="req_type"" name="req_type" ..

But I would like to get sth like:
<div class="usercontent" style="display:block;">  
               <div id="dcdiv" style="background-color:#f3f3f3;  " >
                            <form method="post" action="./../processrequest.php">
                            <input type="hidden" id="req_type"" name="req_type" ..
Instead of all elements cramped to each other.

I tried using the new line in my echos but that didn't work. Maybe I am using it wrong. I also found sth like END ECHO >>.

Thanks
Raz

ucsdmbdmAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
I usually add a "\r\n" at the end of each echo if I need to be able to read the srouce better.  Note that I used two sections in the code below.  The section I put single quotes around it because there were double quotes in the string and in the second I used double quotes because PHP will not consider "\r\n" to be a CRLF in a single quoted string, it will merely print or echo it as a literal.  You can also use "\t" for a horizontal tab if you want.
echo '<div id="dcdiv" style="background-color:#f3f3f3;" >'."\r\n";

Open in new window

0
 
MaartenHensenCommented:
use \n for a newline and \t for a tab in your strings...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.