RE: [PHP] Simple If-else statement
| From: | Johnson, Kirk | Date: | Tue, 27 Mar 2001 18:47:09 +0000 |
| Subject: | RE: [PHP] Simple If-else statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45754@lists.php.net to get a copy of this message | ||
This code is checking if $fname and $lname are equal to a single blank
character. Is this what you want? My guess is you really want
if(($fname == "") || ($lname == ""))
Another way to write this is
if( (!$fname) || (!$lname) )
Kirk
> -----Original Message-----
> From: Louis Brooks [mailto:mbrooks@mailer.fsu.edu]
> Sent: Tuesday, March 27, 2001 11:34 AM
> To: php-general@lists.php.net
> Subject: [PHP] Simple If-else statement
>
>
> Hi:
>
> I am trying to set up a simple script that will verify that
> all the blanks
> in a form have been filled out and then submit that to mySQL.
> If the form
> has not been completely filled out I want it to redirect them
> back to the
> original form. I know that the mySQL part of the script
> works, but I am
> unable to get the part of the script that checks the form
> input to see if
> everything was filled out to work. It seems to bypass this
> part of the
> script and enter the info into mySQL . Here is what I have so far:
>
>
> If (($fname == " ") || ($lname == " "))
> {
> header("Location:
http://callook.org/member_joinform.html");
}else{
$db = mysql_connect("localhost", "name", "password");
mysql_select_db("dBase",$db);
$sql = "INSERT INTO