close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

I'm having a problem with checkbox groups

Thread began 1/11/2012 3:21 pm by cgdm93096 | Last modified 9/06/2012 11:34 am by Jason Byrnes | 2461 views | 12 replies |

cgdm93096

I'm having a problem with checkbox groups

I have two checkbox groups on a form so that I’m able to have multiple selections. The contents of the submitted email from the checkbox groups both come back saying “array” instead of the selected list values. The rest of the content of the form is coming through correctly.

I’m using CSS Form Builder 2.01_SR2 with Dreamweaver CS5 on Windows 7.

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code to line 1 of the page:

php:
<?php
if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

cgdm93096

That corrected the problem and thanks for the quick reply!!

Sign in to reply to this post

info72555

I feel silly for not being able to get this to work :o(

I inserted this code at the top of the template. The values are now being shown correctly when I receive the message (it showed "Array" previously).

The problem is that after submitting the form I now get a whole bunch of error messages like:
- Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts
- Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
- Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts\

I have read other posts about fixing the issue of having check box groups create an "Array" error in the output email but I cannot figure out what code to insert where because it does not work for me...

Please help...

Sign in to reply to this post

Jason ByrnesWebAssist

the code to convert the array should not be added to the email template, it should be added to the form page.

the error you are getting will happen as a result of output between php tags. See the following thread for more details:

showthread.php?t=19285

Sign in to reply to this post

info72555

Using the code in the Form...

I tried that previously - no luck. Once I submit the form I get very similar error messages.

The code:
<?php require_once("webassist/form_validations/wavt_scripts_php.php"); ?>
<?php require_once("webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php
// This code needs to be added for checkbox groups
if($_SERVER["REQUEST_METHOD"] == "POST") {
foreach($_POST as $key => $val) {
if(is_array($_POST[$key])) $_POST[$key] = implode(", ", $_POST[$key]);
}
}
// End code
?>
<?php
if (isset($_POST["PlantCare_submit"])) { ......




--- Errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php on line 85

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php on line 85

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\webassist\email\mail_php.php on line 274

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\webassist\email\mail_php.php on line 274

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php on line 115

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php:12) in D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.php on line 115

Sign in to reply to this post

Jason ByrnesWebAssist

the error is saying that there is output at line 12:
output started at D:\inetpub\vhosts\plantcare.ca\httpdocs\Contact.ph p:12

that is causing the error.

normally it is caused by a blank space or line between php tags.

i would need a copy of the Contact.php page to troubleshoot any further.

Sign in to reply to this post

info72555

Thank you in advance :o)
The entire file was 22 kb so I hope the condensed version helps...

Attached Files
Contact.txt
Sign in to reply to this post

Jason ByrnesWebAssist

well, lines 1 -13 are:

php:
<?php require_once("webassist/form_validations/wavt_scripts_php.php"); ?>
<?php 
require_once("webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php
// This code needs to be added for checkbox groups
if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
// End code
?>




line 13 has a blank space at the end that is causing the error:
"?> "

delete the space after the closing php tag to correct the error

Sign in to reply to this post

info72555

Thank you Jason!!
Now here is my question: this code (with the blank spaces) is generated by Form Builder so I am now wondering whether there is a fix/patch for your extension to prevent blank spaces from being inserted in the first place? What confused me is that the form works perfectly fine if I don't use checkbox groups.

Can you make a recommendations to help avoid this glitch? I vaguely recall I was asked to replace a "WAFB_ListValues.htm" file but that was for DW CS4 so I was not sure if it applies to CS5 as well.

Any suggestions?

Your support is outstanding - I have never come across any company responding as quickly as you do so THANK YOU!!!!! :o)

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...