Of course it's legal, absolutely.

You have to make sure though that you
don't use double quotes in php portion,
and if you do, you have to escape them
for instance:

echo "<font color=\"red\">";

if you paste the code that's causing the
problem, we can take a look.

Vlad

-----Original Message-----
From: Brad Harriger [mailto:[EMAIL PROTECTED]] 
Sent: 14 березня 2002 р. 10:52
To: [EMAIL PROTECTED]
Subject: [PHP] If...Else question

Is it legal for an if...else statement to span PHP code blocks? Here's 
an example:

<?

$a = 0;
if ($a < 5) {
   $b = 50;
   $c=500;

// Take a break from php and put in some HTML

?>

<HTML>
   <HEAD></HEAD>
   <BODY>MORE HTML CODE HERE</BODY>
</HTML>

<?

// Now back to the PHP code

   $d = 250;
}
else {
   $e = "Does not apply."
}

?>

I have some code similar to this example.  When I run the code in my 
browser, I get a parse error on the last line (?>).


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to