You are here: Re: header() with if/then statements « PHP Programming Language « IT news, forums, messages
Re: header() with if/then statements

Posted by Jerim79 on 11/17/06 19:55

e_matthes@hotmail.com wrote:
> > It can still be conditional. Put it at the top, and if everything is
> > OK, just have it fall through to the HTML.
> >
> > BTW - this is a very user-unfriendly way of doing it. You should rather
> > check all the options, then if any are incorrect, redirect with all of
> > the invalid information. This way if there are three things wrong, the
> > user must gets an error message for the first one and corrects it. Then
> > he gets an error message for the second one, and so on.
> >
> > If you check them all, you can display all three error messages at the
> > same time. Much more user friendly.
>
> Something like this, I believe:
>
> <?php
>
> // Code to check validity of data.
>
> if (everything valid) {
> // code to process data
> // redirect to new page
> } else {
> // Set error messages for individual data elements.
> }
>
> ?>
>
> <html>
>
> <form>
> <input 1>
> <?php if ($errorMsg1 != "") print $errorMsg1 ?>
> <input 2>
> <?php if ($errorMsg2 != "") print $errorMsg2 ?>
> ...
>
> </html>

I appreciate the help. I think the concept is getting clearer. I am
just curious though. The first time a person loads the webpage wouldn't
the php execute and since all of the variables are null, wouldn't it
automatically display an error message even before the person has had a
chance to fill out the form?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация