Hi Erik,
I think that you look for array_count_values().
Regards,
Andrey
----- Original Message -----
From: "Erik Price" <[EMAIL PROTECTED]>
To: "John Fulton" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:58 PM
Subject: Re: [PHP] empty() & texarea
>
> On Friday, March 1, 2002, at 11:45 AM, John Fulton wrote:
>
> >
> > I can't seem to get empty() to check if someone has left
> > a textarea unanswered in an online form with code like
> > the following:
> >
> > <textarea rows=8 cols=50 name=open_why_good_consult>
> > <?echo $open_why_good_consult?>
> > </textarea>
>
> In cases where you have provided a default value to fill in the form,
> you can't use empty() to test the value of the result. What I would
> recommend that you do is you test to see if the value is the same as
> what it was filled in by default, and if so, you know the user hasn't
> changed anything.
>
> <?php
> $original_good_consult = $_POST['openWhyGoodConsult'];
> ?>
> <textarea rows="8" cols="50" name="openWhyGoodConsult">
> <?php echo $openWhyGoodConsult; ?>
> </textarea>
> <input type="hidden" name="originalGoodConsult" value="<?php echo
> $original_good_consult; ?>" />
>
> ...later in the script
>
> if ($_POST['openWhyGoodConsult'] == $_POST['originalGoodConsult']) {
> // then you know nothing has changed, the values are the same,
> // so take some action to remind them such as echoing "Please
> // fill in the Good Consult field" or whatever
> } else {
> // then you know they have entered a new value, so you can
> // perform whatever code you need to on that
> }
>
>
>
> HTH
>
> Erik
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php