I have a form with 3 checkboxes x1,x2,x3. I want to build an array of
values from the checked boxes; I choosed the following approach:
1. build an array with all values
2. eliminate from array the "" values using unset

CODE:

  $x = array($_POST['x1'],$_POST['x2'],$_POST['x3']);
  do {
   for ($i=0;$i < sizeof($x);$i++) {
    $stop = 0;
    if (!trim($x[$i])) {
     $stop = 1;
     unset($x[$i]);
     break;
    }
   }
  }
  while ($stop>0);


For some reason, the code doesn't work (loops ad infinitum). But replacing

unset($x[$i]);

    with
    
array_splice($indice, $i, 1);

it does.

Help!

-- 
 Ciprian

> Remember that you are unique. Just like everyone else.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to