|
Posted by J.O. Aho on 05/04/06 07:16
Starbuck wrote:
> Hi,
>
> I would really appreciate some points of view about the best way of
> validating mandatory fields and redirecting them back to the page that will
> outline the text fields label (in red) to denote values that are missing
> without losing the information that the user has already keyed in. There is
> a lot out there about how to do this in java script, however, my client has
> requested no java script is to be used. I have included a sample of my code
> so far, and I would be grateful for any suggestions or changes that I should
> be making to the functionality or any other suggestions/criticisms.
first you need to make a big if statement that checks if all the required are
set, if so, then process the data, if not, then type out the form and out over
that:
Check that the value is empty and the page has been submitted
if(!empty($submit) && empty($something)) {
echo "<font color=\"red\">Something: </font>";
} else {
echo "Something: ";
}
To set the value back, you need to make
<input type="text" name="something" value="<?PHP echo $something; ?>">
//Aho
[Back to original message]
|