Getting Check box values using array in PHP
Many times we have to display a list of names or records for consideration and out of which user can select any number of records for further action. Here we may not know exactly how many records will be displayed as some time based on different conditions records will be collected from a table. So we can list the records with a checkbox by the side of it and user can select any number of recodes. We will have one unique id associated with each record and that will be used as value of the check box. Here is the code to display a list and then you can select and submit to see the result.
This is a server side solution and we can get the array value using client side JavaScript we can also get the value of the array of checkboxes.
Note that if in your server settings global variables is set to OFF then you have to take care for that.
To remove one extra , at the end of the output we used rtrim function.
This article is written by plus2net.com team.
plus2net.com
|