
February 23rd, 2002, 04:45 PM
|
|
Member
|
|
Join Date: Feb 2002
Location: Den Haag, Netherlands
Posts: 69
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
It helps if you don't mix large pieces of HTML and PHP, and definitely not in PHP control structures. For example, line 48-50,
PHP Code:
if ($num_rows == "0") {
echo "<P><strong>There are no items in your cart.</p>";
} else {
and then follows a lot of HTML. Where does the else block end? No wonder you get confused.
What I usually do, is first arrange all the complicated PHP stuff, then put all the HTML as 'here doc' text, in which you can insert PHP variables. Example:
PHP Code:
<?php
// First all PHP stuff
if( $something ) {
$message = "Some message";
} else {
$message = "Another message";
}
// Now the HTML stuff
echo <<<PAGE
<HTML>
...
<p>Message: $message</p>
...
</HTML>
PAGE;
?>
__________________
Code:
Groetjes van Harry! 8-)
|