I've created two forms with a variety of questions. On both forms, one of the questions contains several checkboxes that, when filled in and submitted, only output the word "array" to my database.
The first form I've created, I moved the order of the questions around (up, down, 1, 2, 3, 10 times), but the 2nd time I simply created a clean form, without moving anything. No matter... still happens!!!
I've read most forum threads and none mention any actual solutions for this. Does anyone found any yet? Please... there must be a solution for this... Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where field is the variable name from your form that represents the check boxes, and $field_opts is what you use in your email message in place of the variable that results in "array".
Ultimately the solution depends on what you are trying to achieve. If you still have difficulty feel free to send me a note describing your troubles.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You code is correct. If you are getting the emails you can see that the array data is extracted and displayed.
So maybe I don’t understand what your problem is.
The form has a set of check boxes. Check boxes by design pass an array of data from the form to the processor.php file. The processor.php file extracts the data from the array so that it can be displayed in a more useful way when sending the email or displaying the data on a confirmation page. As you can see by your code the mysql section stores $_POST['field_5'] which is the array from the form check box section. When you extract the mysql array (just as the form passes the array to the processor.php file, you have to flatten the array for further processing and/or display or email. If you just look at the mysql data using something like phpmyadmin you will see field_5 as an array. This array contains the check box data from your form it just needs to be handled correctly in order for you to see all the array data.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've created two forms with a variety of questions. On both forms, one of the questions contains several checkboxes that, when filled in and submitted, only output the word "array" to my database.
The first form I've created, I moved the order of the questions around (up, down, 1, 2, 3, 10 times), but the 2nd time I simply created a clean form, without moving anything. No matter... still happens!!!
I've read most forum threads and none mention any actual solutions for this. Does anyone found any yet? Please... there must be a solution for this... Thanks
Something like this in the process.php file.
// Checkbox handling
$field_opts =$_POST['field'][0].",". $_POST['field'][1].",".
$_POST['field'][2].",". $_POST['field'][3].",". $_POST['field'][4].",".
$_POST['field'][5].",". $_POST['field'][6];
Where field is the variable name from your form that represents the check boxes, and $field_opts is what you use in your email message in place of the variable that results in "array".
Ultimately the solution depends on what you are trying to achieve. If you still have difficulty feel free to send me a note describing your troubles.
My code is not so different... right?
// Checkbox handling
$field_5_opts = $_POST['field_5'][0].",". $_POST['field_5'][1].",". $_POST['field_5'][2].",". $_POST['field_5'][3].",". $_POST['field_5'][4].",". $_POST['field_5'][5].",". $_POST['field_5'][6].",". $_POST['field_5'][7].",". $_POST['field_5'][8].",". $_POST['field_5'][9].",". $_POST['field_5'][10].",". $_POST['field_5'][11].",". $_POST['field_5'][12].",". $_POST['field_5'][13].",". $_POST['field_5'][14].",". $_POST['field_5'][15].",". $_POST['field_5'][16].",". $_POST['field_5'][17].",". $_POST['field_5'][18].",". $_POST['field_5'][19].",". $_POST['field_5'][20];
You code is correct. If you are getting the emails you can see that the array data is extracted and displayed.
So maybe I don’t understand what your problem is.
The form has a set of check boxes. Check boxes by design pass an array of data from the form to the processor.php file. The processor.php file extracts the data from the array so that it can be displayed in a more useful way when sending the email or displaying the data on a confirmation page. As you can see by your code the mysql section stores $_POST['field_5'] which is the array from the form check box section. When you extract the mysql array (just as the form passes the array to the processor.php file, you have to flatten the array for further processing and/or display or email. If you just look at the mysql data using something like phpmyadmin you will see field_5 as an array. This array contains the check box data from your form it just needs to be handled correctly in order for you to see all the array data.