|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Collecting Multiple Answers for One Question with HTML Checkboxes, PHP & MySQL
Hello everyone! This is regarding PHP & MySQL.
I have a form that website users fill out and send me there comments. Using a PHP script I created, the comments are posted to a MySQL table and I retrive them via a private admin section. My Questions: How do I use HTML Form Checkboxes to collect multiple answers for one question? I'm using a Column Data String Type of VARCHAR to store the answers. I guess that is ok. Also, when the form is inserted into the database table the "Respond_Via" field only contains the word "Array". I guess my problem is I don't know how to get the checkbox responses out of the Array and into the column as the user's selected answers. Also please let me know what the INSERT statement should look like. I'm also inserting TEXT and TEXTAREA input fields as well, so I'm not sure if I can insert those types at the same time as the checkbox type. Here is the html I use for the form question. All the checkboxes are named the same, which is I belive how it should be: Code:
Preferred Response Methods: <input type="checkbox" name="Respond_Via[]" value="E-mail" border="0"> E-mail. <input type="checkbox" name="Respond_Via[]" value="Phone" border="0"> Phone. <input type="checkbox" name="Respond_Via[]" value="Fax" border="0"> Fax. <input type="checkbox" name="Respond_Via[]" value="Mail" border="0"> Mail. <input type="checkbox" name="Respond_Via[]" value="None" border="0"> None. Many thanks to anyone who can help me with this! - Steve Just incase you need to know.. my current setup is: Solaris 2.7 Apache 1.3.3 MySQL Version 3.23.43 PHP 4.1.0 Apache Modules |
|
#2
|
|||
|
|||
|
RE: Collecting Multiple Answers for One Question with HTML Checkboxes, PHP & MySQL
I have a tutorial I posted a few days ago that deals with forms and PHP. You might want to look at it. It addresses getting values out of checkboxes along with all the other form elements. It is here:
http://codewalkers.com/tutorials.php?show=12 |
|
#3
|
|||
|
|||
|
RE: Collecting Multiple Answers for One Question with HTML Checkboxes, PHP & MySQL
Matt. Thanks for the tutorial. It helped out alot!
- Steve |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Collecting Multiple Answers for One Question with HTML Checkboxes, PHP & MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|