Hey!!! thank you for your answer... what you think about this solution:

while(list($key, $val) = each($cb)) {
 if ($val == 1 && $key != 0) {
  $acc = $key;
} else {
  $acc = $acc.",".$key;
}

}
// by the way this: $acc=.$key would be a valid command? like the c++ $a =+
$b

in this solution I store all the indexes that have a value 1 or that are
setted.. so let's say tha the user had click in 2,4,8,25 I would have
$acc=2,4,8,25... later on I explode that and I will have the clicks...

What do you think?

Rom

----- Original Message -----
From: jeremy brand <[EMAIL PROTECTED]>
To: Romulo Roberto Pereira <[EMAIL PROTECTED]>
Cc: php-general <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 5:27 PM
Subject: Re: [PHP] srtoring user selection on the database...


Yes you can.  I hate to say it, but there isn't any one answer.  You
are going to need to keep track of the user (using most any form of
sessions).  Once you can track the user, then use that tracking code
to store the data.  You will have to decide how you want to store it
in your DB.  You could use serialized values (yuck!) or spend some
time with your friend that has taken database class and come up with
some rational, normalized tables to represent your data.  Then store
your data in these tables.  Retrieve them, etc.

Of course, if you don't need to store them more than past the next
page, you could just print them out as <input type=hidden" ... >
elements.

while(list($key, $val) = each($cb))
  print '<input type="hidden" name="cb[' .$key. ']" value="'
.htmlspecialchars($val). '">' . "\n";

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "LINUX is obsolete"  -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       http://www.JEEP-FOR-SALE.com/ -- I need a buyer
  Get your own Free, Private email at http://www.smackdown.com/

On Thu, 18 Jan 2001, Romulo Roberto Pereira wrote:

> Date: Thu, 18 Jan 2001 17:18:15 -0500
> From: Romulo Roberto Pereira <[EMAIL PROTECTED]>
> To: php-general <[EMAIL PROTECTED]>
> Subject: [PHP] srtoring user selection on the database...
>
> hello!
>
> I have a form and in this form I have 48 checkboxes. is there a way that
my program could remember which ones were selected?
>
> looks like this::
>
> <form>
> <input type=checkbox name=cb[0] value=1>
> <input type=checkbox name=cb[1] value=1>
> <input type=checkbox name=cb[2] value=1>
> <input type=checkbox name=cb[3] value=1>
> <input type=checkbox name=cb[4] value=1>
>     ...
> <input type=checkbox name=cb[45] value=1>
> <input type=checkbox name=cb[46] value=1>
> <input type=checkbox name=cb[47] value=1>
> </form>
>
> I would lke to remember which ones the user clicked on...
>
> Thank you!
>
> Rom
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to