Google Groups Home
Help | Sign in
Check for Empty String, $_POST, $_GET function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
rojas....@gmail.com  
View profile
 More options Dec 27 2007, 4:04 pm
From: rojas....@gmail.com
Date: Thu, 27 Dec 2007 13:04:51 -0800 (PST)
Local: Thurs, Dec 27 2007 4:04 pm
Subject: Check for Empty String, $_POST, $_GET function
This function will allow you to check if a value is empty or NULL.,
very useful on forms.

--------------------------------------------------------------------------- ------------------------------------------------

function checkEmpty($variable){
if($variable == NULL || $variable == ''){
$isempty = true;

} else {

        $isempty = false;
        //End if

}

--------------------------------------------------------------------------- ----------------------------------------------

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Will  
View profile
 More options Dec 27 2007, 9:49 pm
From: Will <jazze...@gmail.com>
Date: Thu, 27 Dec 2007 18:49:58 -0800 (PST)
Local: Thurs, Dec 27 2007 9:49 pm
Subject: Re: Check for Empty String, $_POST, $_GET function

On Dec 27, 4:04 pm, rojas....@gmail.com wrote:

> This function will allow you to check if a value is empty or NULL.,
> very useful on forms.

> --------------------------------------------------------------------------- ------------------------------------------------

> function checkEmpty($variable){
> if($variable == NULL || $variable == ''){
> $isempty = true;} else {

>         $isempty = false;
>         //End if

> }

> --------------------------------------------------------------------------- ----------------------------------------------

You forgot a return statement. Add <code>return $isempty;</code> after
you close the else block.

Because this function simply returns the value of a conditional test,
its possible to write this function with only one line in the function
body:
<pre>function checkEmpty($variable) {
    return ($variable == NULL || $variable == '')


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rojas....@gmail.com  
View profile
 More options Dec 27 2007, 10:24 pm
From: rojas....@gmail.com
Date: Thu, 27 Dec 2007 19:24:58 -0800 (PST)
Local: Thurs, Dec 27 2007 10:24 pm
Subject: Re: Check for Empty String, $_POST, $_GET function
Updated Code:

function checkEmpty($variable){
if($variable == NULL || $variable == ''){
$isempty = true;

} else {

        $isempty = false;
        //End if

}

return($isempty);

}

------------/// That Should do it ///------
Thanks will for pointing it out.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google