I am developing a regisration page that will present a set of check
boxes to the viewer. This list of checkboxes is developed from a list
in a database so the amount and names of the boxes will change. This
portion works just fine.
The page content has a user name and password along with several sets
of these checkboxes. All the form content of this page is presented in
one form.
The problem:
I want to store the values presented in these checkboxes back into the
database based on what the user selects. The data will be stored in a
table that has the id for the user and the id for the checkbox item.
As anyone knows, checkbox's only send a boolean value through POST so
once the data is sent it is nearly impossible to test for its value
and work on it since these are dynamically presented.
What I mean by dynamically presented is that the list is pulled from a
database. The checkboxes are build as such: <p><input
type=\"checkbox \" name=\"{$row['name']}\">{$row['name']}</p>. $row is
the reference to the database result set that has been affected by the
row_assoc function.
Since I have no idea what the contents of $row['name'] will be. I
cannot use isset($_POST['checkboxname']) to test its value as you
would normally do. As I see it 'checkboxname' is just a string and so
it seems logical to me that this would work:
isset($_POST['$row['name']']), but it doesn't.
My request:
I need to be able to check to see if the checkbox is check like such:
isset($_POST['$row['name']']) so I can check the value of
$_POST['$row['name']']. What is the correct way to run this check if
it is at all possible? Or is there another way to do this or a more
effective way to do this?
boxes to the viewer. This list of checkboxes is developed from a list
in a database so the amount and names of the boxes will change. This
portion works just fine.
The page content has a user name and password along with several sets
of these checkboxes. All the form content of this page is presented in
one form.
The problem:
I want to store the values presented in these checkboxes back into the
database based on what the user selects. The data will be stored in a
table that has the id for the user and the id for the checkbox item.
As anyone knows, checkbox's only send a boolean value through POST so
once the data is sent it is nearly impossible to test for its value
and work on it since these are dynamically presented.
What I mean by dynamically presented is that the list is pulled from a
database. The checkboxes are build as such: <p><input
type=\"checkbox \" name=\"{$row['name']}\">{$row['name']}</p>. $row is
the reference to the database result set that has been affected by the
row_assoc function.
Since I have no idea what the contents of $row['name'] will be. I
cannot use isset($_POST['checkboxname']) to test its value as you
would normally do. As I see it 'checkboxname' is just a string and so
it seems logical to me that this would work:
isset($_POST['$row['name']']), but it doesn't.
My request:
I need to be able to check to see if the checkbox is check like such:
isset($_POST['$row['name']']) so I can check the value of
$_POST['$row['name']']. What is the correct way to run this check if
it is at all possible? Or is there another way to do this or a more
effective way to do this?
Comment