On Fri, 02 Feb 2001 17:31:43 -0500, Thomas Deliduka
([EMAIL PROTECTED]) wrote:
>I looked through the archives and couldn't find anything on this.
>
>I have a web form which takes 9 values to create a definition for a
>table
>that would have up to 9 columns.
>
>I made the table so that each form field is submitted as an array so
>that I
>can simply step through each value and create the table definition,
>so:
>
><input type=text name="tblcol[]">  (duplicated 9 times)
>
>Now, when I submit the form the resulting array always has 9
>elements and
>some of those will be empty.
>
>I would like to do error checking in case people didn't fill
>anything at all
>so I thought using if (!count($tblcol)) {.... But that doesn't work
>since it
>always has 9 elements.
>
>Is there a way to find out if an array contains no values even
>though it has
>elements?  Sort of like a trim() function on an array to destroy the
>elements in the array that are empty.
>
>Is it possible?

while(list($key,$value)=each($array)){
        if(empty($value)) unset $array[$key];
}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to