Brack wrote:

> if you have structure like
> <html>
> <?php
> if (isset(...)){
> ..;
> }
> elseif (isset()){
> }
> else {
> ..
> ?>
> </html>
> then you need to insert "}" before "</html>
> or if you use syntax
>

Correct, in part.  The last ELSE has a starting {,  but no ending }.
It should go before the ?> not </html>, that would place it outside the PHP
code block.


> <html>
> <?php
> if (isset()):
> ..;
> elseif (isset()):
> ..;
> else:
> ..;
> ?>
> </html>
> you have to insert "endif;"
> If you think you did it but still have an error, try to count your "if"
> statements and "endif;" maybe something is missing.
>
> Youri

the correct structure would be:

<html>
<?php
if ( condition ) {
    multiple ;
    statements for condition=true, all ended with ";" (semi-colon) ;
}
elseif ( other_condition) {
    multiple ;
    statements for other_condition=true, all ended with ";" (semi-colon) ;
}
else {
    other block ;
    of multiple lines ;
}
?>
</html>

Note that curly braces (expression group) does not need the semicolon after
them.

If the IF, ELSEIF or ELSE constructs just need to execute one line then

<html>
<?php
if (condition)
                echo "whatever"  ;
?>
</html>

the constructs themselves don't need an ending semicolon

Elias

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to