Re: Control structures



On Nov 5, 3:42 pm, "pgt" <pgt...@xxxxxxxxx> wrote:
I need to cease the execution of some code if a couple of conditions are not
met.

exit; destroys the rest of my page of course, so I *think* I need some sort
of "wrapper", perhaps in a control structure?

The page works flawlessly otherwise (and reporting is set to
error_reporting(E_ALL); )

<body>
<div>
<?php
if (error checking here)
{echo 'error message';}
elseif (secondary error checking here)
{echo 'more error messages';}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
// other stuff
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I need to NOT execute anything within 'CONTAINER' when the if/elseif
statements are not met, but I DO need to continue with the html above the
closing div, so the rest of the page displays normally.

How to "wrap" this? Or ... ?

<body>
<div>
<?php
$skip=false;
if (error checking here)
{echo 'error message';$skip=true;}
elseif (secondary error checking here)
{echo 'more error messages';$skip=true;}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
if (!$skip){
// other stuff
}
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I think that does what you want? I just added a new variable $skip...

.



Relevant Pages

  • Re: Control structures
    ... {echo 'more error messages';} ... I need to NOT execute anything within 'CONTAINER' when the if/elseif ... closing div, so the rest of the page displays normally. ...
    (comp.lang.php)
  • Control structures
    ... I need to cease the execution of some code if a couple of conditions are not ... {echo 'more error messages';} ... I need to NOT execute anything within 'CONTAINER' when the if/elseif ...
    (comp.lang.php)
  • Re: [PHP] how to use php from mysql to xml
    ... and i want to use php,select it and make a xml to save it,now i use this ... /// create the table container ... echo $table->asXML; ...
    (php.general)
  • html output lines
    ... given that php ... echo 'whatever'; ... the output html is ...
    (comp.lang.php)
  • NOCC Webmail <= 1.0 multiple vulnerabilities
    ... "NOCC is a webmail client written in PHP. ... remote code execution, there are two ways of execute arbitrary code on ... is defined in conf.php, by default no path is defined, but script suggests ... echo nl2br); ...
    (Bugtraq)