|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Hi,
I have a database and one of the fields is populated by a multi-selection form field, in this case, checkboxes. I've named all the checkboxes the same name as the field and allocated different values to each but only the first checkbox value shows up in the database. Is there some trick here? Do I need a separate field for each? I would just like to have them listed in the database. Thanks to anybody who can help me! ![]() |
|
#2
|
||||
|
||||
|
Add a pair of squarebrackets to the end of your field name in the HTML form - when that field is returned to your script, you'll be able to access the field values as an array. Yes, it's a dodgy hack, but it's the only way PHP can do it.
More info: http://academ.hvcc.edu/~kantopet/ph...php+client+side "Form field names" section |
|
#3
|
|||
|
|||
|
Thanks Stumpy. I will try that!
|
|
#4
|
|||
|
|||
|
Hi Stumpy - Okay - so I've added the square brackets and been to your site and it all seems to make sense, until I run the script and I keep getting parse error. I did this with Dreamweaver MX so maybe the script is slightly different:
This is the original code to extract checkbox data from a form with checkboxes named 'interests[]' with values: Business, Entertainment and Finance PHP Code:
Does the array go in like this? PHP Code:
or this? PHP Code:
whatever combination I use brings up a parse error. On you site you wrote Quote:
I'd appreciate any assistance!Thanks in advance! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Help! I need to write multi-selection form data into field? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|