Kris Yates wrote:
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
Parser: foreach($_POST as $ThisVar=>$ThisVal){ if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){ $newVarA=explode("-", $ThisVar); $colors.="$newVarA[1]:"; } }
Expected Output:
$colors="1:4:6:";
Real Output:
$colors=":1:4:6:";
I can work with the output I am getting, however, I am curious why I am not getting the "expected output". Can anyone shed light on this? I am using PHP 4.3.2 compiled under a unix environment. Is this a bug in ereg or am I just not seeing something obvious in my foreach?
Thanks,
Kris
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php