Control structures
am 05.11.2007 22:42:32 von pgt
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); )
if (error checking here)
{echo 'error message';}
elseif (secondary error checking here)
{echo 'more error messages';}
// exit;
?>
// other stuff
?>
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 ... ?
Re: Control structures
am 06.11.2007 00:42:25 von yawnmoth
On Nov 5, 3:42 pm, "pgt" 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); )
>
>
>
>
> if (error checking here)
> {echo 'error message';}
> elseif (secondary error checking here)
> {echo 'more error messages';}
> // exit;
> ?>
>
>
>
> // other stuff
> ?>
>
>
>
>
>
>
> 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 ... ?
$skip=false;
if (error checking here)
{echo 'error message';$skip=true;}
elseif (secondary error checking here)
{echo 'more error messages';$skip=true;}
// exit;
?>
if (!$skip){
// other stuff
}
?>
I think that does what you want? I just added a new variable $skip...
Re: Control structures
am 06.11.2007 20:56:27 von pgt
"yawnmoth" wrote in message
news:1194306145.402907.32110@o38g2000hse.googlegroups.com...
> On Nov 5, 3:42 pm, "pgt" 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); )
>>
>>
>>
>>
>> if (error checking here)
>> {echo 'error message';}
>> elseif (secondary error checking here)
>> {echo 'more error messages';}
>> // exit;
>> ?>
>>
>>
>>
>> // other stuff
>> ?>
>>
>>
>>
>>
>>
>>
>> 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 ... ?
>
>
>
>
> $skip=false;
> if (error checking here)
> {echo 'error message';$skip=true;}
> elseif (secondary error checking here)
> {echo 'more error messages';$skip=true;}
> // exit;
> ?>
>
>
>
> if (!$skip){
> // other stuff
> }
> ?>
>
>
>
>
>
>
> I think that does what you want? I just added a new variable $skip...
Thank you so much. Couldn't see the wood because the forest got in the way
;-)
Much appreciated :-))