RE: [PHP] Select Field Form Value

From: Date: Sat, 22 Feb 2003 23:43:04 +0000
Subject: RE: [PHP] Select Field Form Value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136688@lists.php.net to get a copy of this message
> Here is my problem. I am using the following two lines to get multiple > values from a form field select statement. > > while (list($key,$val) = each($_POST[Restrictions])) {$Restrictions .= > "$val,";} > > <tr><td>Restrictions</td><td>$Restrictions</td></tr> > > The problem is when it fills out the table, it adds "Array" prior to the > values. Is there an easy way to strip that out? > > Any help is appreciated. Is register globals on? If so, if you tried to echo $Restrictions, it's just print "Array". Since you're using .=, it's going to tack on the values after the "Array". The solution, rather, the best solution, is to turn off register globals. Another option is to use a different variable name than $Restrictions or unset() it before you start adding text to it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#136688) next »