* Thus wrote Kris Yates ([EMAIL PROTECTED]): > Hi, > > I have a form with checkboxes that POSTs to a PHP script. > > What is posted [ from phpinfo() ]: > > _POST["color-1"] on > _POST["color-4"] on > _POST["color-6"] on
There is more post data than this. > > > Parser: > foreach($_POST as $ThisVar=>$ThisVal){ > if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){ > $newVarA=explode("-", $ThisVar); > $colors.="$newVarA[1]:"; > } > } Your logic, as jennifer pointed, isn't probably what your expecting. You're POST data has a value of 1 somewhere. Also, ereg is very expensive for doing exact string matches like you are doing there, best to use the str* functions avaible to do tasks like this. ie: if ('color-' == substr($ThisVar, 0, 6)) And then no need to explode into an array and then extract the value (more overhead).. since the format is known you can do something like: $colors .= substr($ThisVar, 6); HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php