Jump to content

need help on form required fields option


pixeltrace

Recommended Posts

guys,

i need help.... how can i set my form in such a way that the sender must either fill up
either 1 of the 2 fields?

example

name:
company:
email address:

on my condition, email address is required but for name and company, he can either fill up just one of them.
otherwise an error will appear.

from this code what should i do here to fix my problem?

thanks!

[code]echo "<CENTER>";
if (($name == "") || ($company == "") || ($email == "")) {
echo '<br><br><span class="bodytext3">Please complete the form. Thanks!</span><br>';
exit;
}

if(!email_is_valid($email)) {
echo '<br><br><span class="bodytext3"><br>Email Address Invalid. <br>Please use a valid Email Address</span><br>';
echo '<span class="bodytext3"><br>Thank You!</span><br>';           
        exit;
}

[/code]

Link to comment
https://forums.phpfreaks.com/topic/26075-need-help-on-form-required-fields-option/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.