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?

Reply via email to