Re: EMPTY??

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

 



Can you show us the form tag of your php file(html code)?

Dan Shirah 写道:
doing a var_dump($_POST['comments'];

returns  string(0) ""

So the value of $comments in $comments = $_POST['comments']; SHOULD be equal
to 0 or "", right?

In which case when I do my original:

if (!empty($comments)) {
  echo "Do Something";
}

It SHOULD just bypass that and continue with my code, but instead it gives
me the error, "Changed database context to Database."


On 10/23/07, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
On 10/23/07, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
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?
no; strtoupper modifies its argument, that is all.
empty evaluates the argument it is given that is all.
therefore, if empty is passed an string with no contents that has been
passed through
strtoupper, it will still be regarded as empty.

<?php
    $var = strtoupper('');
     if(empty($var)) { echo 'var is empty'; }
?>



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.
try using var_dump(); you will see that it is a string that has no
contents, or perhaps some
whitespace characters.


-nathan





--
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