Reply to Re: header() with if/then statements

Your name:

Reply:


Posted by e_matthes on 11/17/06 19:06

> 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>

[Back to original 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

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