Jump to content

quick question about generated html source code


xfezz

Recommended Posts

the html source code generated from this block of code is one big long line of html code. (seems to scroll like 10 pages across, one div tag after another with the output of the database)

[code]    $SQL = "SELECT * FROM articles ORDER BY id DESC";
    $result = mysql_query($SQL);
      while ($db_field = mysql_fetch_array($result)) {
$now_format = $db_field['article_date'];
$new_format = date('F d, Y',strtotime($now_format)); // transform
                echo "<div id=\"article_date\">". $new_format ."</div>";  // prints out: date in following format October 20, 2006
echo "<div id=\"article_chk\">"."<input type=\"checkbox\" name=\"del_select[]\" value=\"$db_field[id]\" />"."</div>"."<br>";
$db_field['message']=nl2br($db_field['message']);
                echo "<div id=\"article_body\">" .$db_field['message']  ."</div>";
}[/code]

Is there a way to have  the output separated it when viewing the html source code? so it looks nice and neat?
Link to comment
Share on other sites

Or you could simply include the spaces/tabs within the echo statements. This:

[code]<?php
echo "<table>\n";
echo "    <tr>\n";
echo "        <td>Data1</td>\n";
echo "        <td>Data2</td>\n";
echo "        <td>Data3</td>\n";
echo "    </tr>\n";
echo "</table>\n";
?>[/code]

Will output this:
[code]<table>
    <tr>
        <td>Data1</td>
        <td>Data2</td>
        <td>Data3</td>
    </tr>
</table>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.