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:[EMAIL PROTECTED]]
Sent: Monday, January 27, 2003 5:26 PM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to