Correct, which is why in my original post I set two variables.

$comments = strtoupper($_POST['comments']); //This is the value I want saved
in my database.
$check_comments = $_POST['comments']; //This is the value I am using to
determine if there were any comments entered.


On 10/23/07, Nathan Hawks <[EMAIL PROTECTED]> wrote:
>
>
>
> 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?
>
>

Reply via email to