Re: Re: Variable name as a string

From: Date: Wed, 27 Aug 2008 18:31:51 +0000
Subject: Re: Re: Variable name as a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-278813@lists.php.net to get a copy of this message
Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. ioannes wrote:
Yes, Tedd, this does however incur the overhead of find out what i is, because it could be a range of IDs from the database, not necessarily a count of the checkboxes on the page: " for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on')
      {
       my_array[] = $_POST[$b]
      }
} " John


« previous php.general (#278813) next »