I'd suggest weaving in and out whenever possible instead of print()'ing and echo()'ing stuff when you could just close your PHP tag and not worry about parse errors. You'd avoid A LOT of parse errors by weaving in and out, but I still do echo and print within php just out of habit. For example in a while statement
while ($a_row=mysql_fetch_array($query)) {
print "<tr>\n";
print "<td width=200>" . $a_row["field1"] . "</td>\n";
print "<td width=200>" . $a_row["field2"] . "</td>\n";
print "</tr>\n";
}
The other way would be
<?
while ($a_row=mysql_fetch_array($query)) {
?>
<tr>
<td width=200><? echo $a_row["field1"]; ?></td>
<td width=200><? echo $a_row["field2"]; ?></td>
</tr>
<?
}
?>
But since I'm used to printing within while statements (atleast most of the time), this way looks weird to me.
But if i'm writing a .php page, and i'm going to be putting html contents in it like <html> <head> <body> etc, I'd rather just weave in and out of PHP. I'm sure most people would, but it's just a matter or preference--whatever works best for you. I'm sure a lot of people who use one method still occasionally use the other.
Cgraz