Re: newbie - help with field variables in forms

From: Date: Tue, 08 Jan 2002 23:11:46 +0000
Subject: Re: newbie - help with field variables in forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-79829@lists.php.net to get a copy of this message
Hi! A very simple way to do this is by checking the variables of the form (the names of fields) if they are isset() or not. To be more specific you can even check, if any of them is empty(). In special cases like the email address, i suggest using regexp to check if it is a valid email address. The structure i use for this: if (isset($name_of_submit_button) { here comes the checking part if (error_occures) $error = true; } if (isset($name_of_submit_button) && !$error) { send the email } else { show the form itself } this is my way, but there are other good solutions out there as well. > > I established an email feedback form, everything works fine, and now I'd > like to add code to make a couple of fields required. What function would I > use for this and how would it be structured? > > Any help would be appreciated... thanks! you're welcome Balazs

« previous php.general (#79829) next »