RE: [PHP-DB] elseif
| From: | USA) | Date: | Tue, 28 Jan 2003 00:21:42 +0000 |
| Subject: | RE: [PHP-DB] elseif | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25185@lists.php.net to get a copy of this message | ||
You should probably replace $name == "" with strlen($name) < 1.
Also, you should probably used $error .= instead of $error = so that you can list all the errors
instead of just the last one.
<>< Ryan
-----Original Message-----
From: Addison Ellis [mailto:addison@bellsouth.net]
Sent: Monday, January 27, 2003 5:26 PM
To: php-db@lists.php.net
Subject: [PHP-DB] elseif
hello and thank you for your time.
will the below work to check if one field or the other is
filled in upon submission? either contact_phone or contact_email is
required but not both. best, addison
$error = "";
if ($name == "")
{
$error = "$error<LI>You must enter a company name.</LI>";
}
if ($address == "")
{
$error = "$error<LI>You must enter an address.</LI>";
}
if ($city == "")
{
$error = "$error<LI>You must enter a city.</LI>";
}
if ($state == "")
{
$error = "$error<LI>You must enter a state.</LI>";
}
if ($zip == "")
{
$error = "$error<LI>You must enter a zip.</LI>";
}
if ($contact_phone == "")
{
$error = "$error<LI>You must enter a contact phone number or
email address.</LI>";
}
elseif ($contact_email == "")
{
$error = "$error<LI>You must enter a contact phone number or
email address.</LI>";
}
if ($error == "")
{
$query = "insert into stores set
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
addison@bellsouth.net
info@smipco.com
subsidiaries of small independent publishing co.
info@gloabaldog.com
info@momandpocentral.com