|
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>
Navigation:
[Reply to this message]
|