473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Control structures

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); )
<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 ... ?
Nov 5 '07 #1
2 1165
On Nov 5, 3:42 pm, "pgt" <pgt...@gmail.notwrote:
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...

Nov 5 '07 #2
pgt

"yawnmoth" <te*******@yahoo.comwrote in message
news:11*********************@o38g2000hse.googlegro ups.com...
On Nov 5, 3:42 pm, "pgt" <pgt...@gmail.notwrote:
>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...

Thank you so much. Couldn't see the wood because the forest got in the way
;-)

Much appreciated :-))



Nov 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Olivier Parisy | last post by:
Hi all, I am new to Python (I just finished Guido's tutorial). I was very surprised to learn there that the StopIteration is used to end for loops in a standard iterator setting. I come from...
1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
3
by: Paul | last post by:
Hi everyone, I'm hoping someone in the group has had experience with this problem: I was looking through the list of ActiveX controls in Access 97 and found a Microsoft Tree Control which...
2
by: Carolyn Vo | last post by:
I have been looking and looking but can't seem to find out how to get the row selected in a web control datagrid (NOT a web form datagrid!!!), and how to highlight the selected row. I'm sure this...
2
by: Tom Shelton | last post by:
I was goofing around tonight and decided to write a little IP address control. I had written a simple one a long time ago, but I decided I should try to write one that was half way correct :) ...
1
by: Christopher A. Kelly | last post by:
I need to figure out how to control any 3rd party application by simulating mouse click and key presses. I need to take a partial window title and get the handle then be able to send the necessary...
4
by: Yoram Biberman | last post by:
I have a few questions concerning concurrency control. I shall thank whoever can help me. Question #1 ========= Assume the following (concurrent) schedule, in which both transactions run in a...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
2
by: thomasfarrow | last post by:
At work, our development team has a development standards document that insists Structures should never be used. I'm looking to change this standard but need a suitable argument in order to make...
0
by: Derek Martin | last post by:
On Fri, Jul 18, 2008 at 12:21:49PM -0700, mark floyd wrote: One wonders why... :) Even if Python didn't offer a way to write a for loop in a similar fashion (someone else replied about...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.