Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: dynamic check boxes


Message #1 by "Richard D. Williams" <appgrp@e...> on Mon, 16 Jul 2001 14:43:09 -0500
Hi All,

Is there a way to array checkbox input.  I have the following tables;
contracts, conitems,  and services.

Services is a list of available choices related to a contract. These
choicesa re stored in conitems.
I want to show these as checkbox input. If a box is not checked I want
to delete it from conitems.  If a box is checked I want to added that to
conitems.

I have the following line of code:
 echo ("<INPUT TYPE='checkbox' NAME='chk_box[]' VALUE='$chkbox'
$chkbox><b>$t_serv</b>");

$t_serv is the service which is stored via hidden input in $c_serv[].
$chkbox is either 'checked' or blank based on a query to the conitems
table by contract number.
The appropriate boxes are check when I add the services to conitem
manually.  When I try to change these choices thru the program the new
choices are not added.  I have checked the update and insert syntax and
it is fine.  Using an echo I can see that the chk_box array is not
holding the choices. Here is what the input on the page looks like.  Of
course the [  ] is a box.

Service(s): check/uncheck all that apply
       [  ]ART                 [  ]CONSULTANT      [  ]COUNSELOR    [
]DIAG     [  ]IHT
       [  ]MT                   [  ]OT                           [
]COTA                [  ] PT          [  ]PTA
       [  ]PSYCHOED    [  ]PSY ASSOC           [
]PSY                    [  ]SLP        [  ]SLPA

This is not really as clear as I would like it, but if you can see what
I am trying to do, maybe you can help.
Again, the problem is with the array structure. I just can't see it.

Thanks
Richard


  Return to Index