Re: Simple If-else statement
| From: | Johannes Janson | Date: | Tue, 27 Mar 2001 18:51:23 +0000 |
| Subject: | Re: Simple If-else statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45755@lists.php.net to get a copy of this message | ||
Hi,
if ($name == " ") { .... checks for a space in $name.
"empty" is either if (§name == "") without a free space
between "" or you could do it with empty($mane)
if (empty($name)) is true if it is empty (who would
have thought this?)
Johannes
"Louis Brooks" <mbrooks@mailer.fsu.edu> schrieb im Newsbeitrag
news:5.0.0.25.2.20010327132158.009db480@mailer.fsu.edu...
> 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
> members
> (fname,lname,address,city,state,zip,country,email,username,password)
> VALUES
>
('$fname','$lname','$address','$city','$state','$zip','$country','$email','$
user
> name','$password')";
> $result = mysql_query($sql);
> }
>
> I hope the formatting comes out right. I am sure it is something simple I
> have missed but I have tried the script several different ways and nothing
> seems to work. Thank you for any help.
>
> Sincerely,
>
> Louis Brooks
>
> BTW: Is there a faq for this list before I go asking anymore questions?
>