Forum Moderators: coopster

Message Too Old, No Replies

Skip to Line command?

         

TymArtist

6:06 pm on Sep 23, 2005 (gmt 0)

10+ Year Member



Hello fellow PHPers. I've made a few posts in the past few days and really appreciate your help. Now i'm at the end of my project - getting a database submission/send email form to validate.

I get all the correct errors if the person doesn't enter certain fields, and the data doesn't submit. If they do enter all the required fields, it submits...

However, the code for when it doesn't submit reads...
if ($errmsg!= "") {
echo $errmsg;
} else {
the rest of the code
the rest of the html syntax

My problem is that if the error page comes up, the rest of the HTML doesn't get rendered because the PHP simply quits. Is there a command in PHP in terms of "Go To Line This in the document", so rather than exiting it would just skip the rest of the PHP but still print all the HTML. I thought of switching!= to == but the way in which that works fails as well. I'm thinking I might have to validate straight on the form rather than the submission page, but let me know what you know!

Please help! :)

StupidScript

6:39 pm on Sep 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if ($errmsg!= "") {

echo $errmsg."<br />\n";

the rest of the html syntax

} else {

the rest of the code

the rest of the html syntax

It depends, also on the type of error that has been experienced. If it's a "fatal" PHP error, the program will always be killed. If it's a form data validation error, then the above should work for you.

(I'm not sure what "the rest of the code" means, so I'm assuming it's additional PHP code that you do not want to process unless the form data validates ...?)