Re: Re: Variable name as a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote:
ioannes wrote:
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.

for ($i = 1; $i <= 4; $i++)
   {
   $a = 'a' . $i;
   $b = 'whatever' . $i;
   if($_POST[$a] == 'on')
      {
       my_array[] = $_POST[$b]
      }
   }
"

John


Either I'm missing what you're trying to do, or this has become incredibly over complicated!

-Shawn

It's not over complicated, but just a method of passing checked checkbox values to a php array. Do you have something better?

Cheers,

tedd


I guess you missed my last post, it was maybe the first or second reply to this thread:

<input type="checkbox" name="data[field_name]" id="my_checkbox_1" value="1" >

Then on post you have a $_POST['data'] array that contains the field_names as keys and the checkbox values as values.

That's why I was wondering if I was missing something.

-Shawn

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux