Checkboxes in custom forms

5 replies · opened May 27, 2016

MmisdirektedMay 27, 2016

Hi there,
I am trying to create a custom form using checkboxes, but I am unable to receive the selected value from the checkboxes when the email is sent. All other field content comes through fine, but not the selected checkbox info. I'm sure I messed up the php file, and I would like some assistance.

The form I am working on is the second form on this page under the heading called "Fundraising" (the first form on the page works fine).
http://dreamclasses.org/about-us/index-test.html

PHP file is attached. Thank you for your help!

SSemicolon WebSTAFFMay 30, 2016

Hello,

The Form Elements in your Form seem to be fine but there definitely appears to be an issue with the Form Processing PHP File. Currently, we do not allow uploading of PHP Scripts on our Server, so can you please provide us with the File using an Alternative Solution like Dropbox or send it to our Email at semicolonweb@gmail.com, so that we can have a look and provide you with the suitable solution for this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

MmisdirektedJun 3, 2016

Good morning,
Have you had a chance to review the php file I linked? Thanks for your help!

SSemicolon WebSTAFFJun 7, 2016

Hello,

[sb_private_reply]Apologies about the Delays in replying to your Query![/sb_private_reply]

We have checked out your Form's PHP Code and the issue is that you have not added the Code that takes the Value of the Checkboxes. Please follow the steps below:

  1. Please find the following code in the include/sendemail.php File:
$program = $_POST['template-fnpform-program'];

and replace it with:

$programs = array();

if( isset( $_POST['template-fnpform-program-fa'] ) ) { $programs[] = $_POST['template-fnpform-program-fa']; }
if( isset( $_POST['template-fnpform-program-ee'] ) ) { $programs[] = $_POST['template-fnpform-program-ee']; }
if( isset( $_POST['template-fnpform-program-hc'] ) ) { $programs[] = $_POST['template-fnpform-program-hc']; }
  1. Now, find the following code:
$program = isset($program) ? "Program Selection: $program

" : '';

and replace it with:

$programs = !empty($programs) ? "Program Selection: " . implode( '
', $programs ) . "

" : '';

This should definitely work fine. Let us know if we can help you with anything else or if you find any further issues.

MmisdirektedJun 7, 2016

Excellent - that works perfectly. Thank you so much :)

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard