RE: [PHP] how can php get the values of a group of checkboxbut the question is how to 
determine the times of loop? the upper bound is hard to find. and the loop does cost 
time though it is not so much.  
  ----- Original Message ----- 
  From: Van Andel, Robert 
  To: Xin Qi ; [EMAIL PROTECTED] 
  Sent: Thursday, November 21, 2002 7:18 PM
  Subject: RE: [PHP] how can php get the values of a group of checkbox


  Use an array (checkbox[1], checkbox[2]).  Then use a loop to pull get the data after 
posting.  If you expect only one choice, use a radio button.

  Robbert van Andel 

  -----Original Message----- 
  From: Xin Qi [mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, November 21, 2002 1:54 PM 
  To: Van Andel, Robert; [EMAIL PROTECTED] 
  Subject: Re: [PHP] how can php get the values of a group of checkbox 



  RE: [PHP] how can php get the values of a group of checkboxthank you, but what if 
all the checkboxes are generated dynamicly? I mean, I do not know how many checkboxes 
where will be until the php script generate the html page completely. if i have them 
unique names, it is kind of boring when php loads $_GET[] because it will be 
$_GET[$one_variable]. 

  For a group checkboxes with the same name, there will be no such problem. 
    ----- Original Message ----- 
    From: Van Andel, Robert 
    To: Xin Qi ; [EMAIL PROTECTED] 
    Sent: Thursday, November 21, 2002 4:26 PM 
    Subject: RE: [PHP] how can php get the values of a group of checkbox 



    Check boxes should not be given the same name.  Radio buttons should to denote a 
grouping.  In other words, if you want to have a bunch of radio buttons indicating a 
choice between items (say bananas, oranges, and apples), you would name them the same 
thing and give them each a different value.  Checkboxes need to be given unique names 
to identify them.  Using the example above, you would have three check boxes one 
called bananas, one called oranges and one called apples.  They are given the value of 
true when they are submitted.  You could probably hard code the value as well, but I 
rarely do so.

    Robbert van Andel 




    -----Original Message----- 
    From: Xin Qi [mailto:[EMAIL PROTECTED]] 
    Sent: Thursday, November 21, 2002 11:14 AM 
    To: [EMAIL PROTECTED] 
    Subject: [PHP] how can php get the values of a group of checkbox 




    hi there, 

    if i have a group of checkboxes, and they have the SAME name, when they are 
    submited into a php script, how can this php file get the value of each 
    checkbox? 

    since they have the same name, $_GET["checkbox_name"] only returns the last 
    one. 

    thanks 





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




     "The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any review, 
retransmission, dissemination or other use of, or taking of any action in reliance 
upon, this information by persons or entities other than the intended recipient is 
prohibited. If you received this in error, please contact the sender and delete the 
material from all computers." 





   "The information transmitted is intended only for the person or entity to which it 
is addressed and may contain confidential and/or privileged material. Any review, 
retransmission, dissemination or other use of, or taking of any action in reliance 
upon, this information by persons or entities other than the intended recipient is 
prohibited. If you received this in error, please contact the sender and delete the 
material from all computers." 


Reply via email to