Re: EMPTY??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Note:  empty() only checks variables as anything else will result in a
parse error. In other words, the following will not work:
empty(trim($name)).


http://www.php.net/manual/en/function.empty.php



On Tue, 2007-10-23 at 13:20 -0400, Dan Shirah wrote:
> I am having some issues with empty().
> 
> On my page I have a text area:
> 
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
>  <tr>
>  <td width="600" align="center"><span class="inputlbl">Comments:
>       <textarea name="comments" tabindex="39" rows="3" cols="45"
> wrap="soft"></textarea>
>       </span> </td>
>  </tr>
> </table>
> 
> I then submit my page and on the following page I put the posted value into
> two variables.
> 
>   $comments = strtoupper($_POST['comments']);
>   $check_comments = $_POST['comments'];
> 
> I made two variables for the same posted value because I believe empty()
> does not work with strtoupper in front of the value. It only works with a
> standalone variable, correct?
> 
> So, once I have assigned my comments to a variable I am doing:
> 
> if(!empty($check_comments)) {
>   echo "Do Something";
> }
> 
> However, if the comments textarea is left blank I just get a generic error
> "Changed database context to database"
> 
> I've tried the below and get the same result:
> if($check_comments != "") {
>   echo "Do Something";
> }
> 
> When comments is left blank and I echo out the value for $check_comments it
> returns nothing at all which is why I think empty() or "" should work, but
> they don't.
> 
> Ideas?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux