You are here: Re: VALIDATING MANDATORY FIELDS USING PHP NOT JAVA SCRIPT!?! « All PHP « IT news, forums, messages
Re: VALIDATING MANDATORY FIELDS USING PHP NOT JAVA SCRIPT!?!

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

 

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

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