Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:30:14+00:00 2026-06-08T18:30:14+00:00

Question: HOW DO I DISPLAY SELECTED CHECKBOXES IN MY EMAIL? I’ve created a survey

  • 0

Question: HOW DO I DISPLAY SELECTED CHECKBOXES IN MY EMAIL?

I’ve created a survey (http://www.hello-rio.com/surveyonshoes/) and I’m trying to get my selected checkboxes to display in my email when the form is submitted. I’m a complete noob when it comes to this, any help would be greatly appreciated

Heres my html sample checkbox code (in index.html):

<label for="colors">What colors do you own? (check all that apply)</label>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="black">black </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="brown">brown </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="beige">beige </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="white">white </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="gold">gold </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="silver">silver </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="red">red </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="blue">blue </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="yellow">yellow </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="green">green </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="orange">orange </div>
<div class="twocol"><input type="checkbox" name="color_flats[]" value="purple">purple </div><br>
<label for="others">Others</label>
<input type="text" name="color_flats[]" class="others" />

and heres the complete php code (contact.php):

<?php

/* Set e-mail recipient */
$myEmail  = "johndoe@domain.com";

/* Check all form inputs using check_input function */
$subject         = "Survey on Shoes";
$Name            = check_input($_POST['Name'], "Enter your name");
$Address         = check_input($_POST['Address']);
$Email           = check_input($_POST['Email']);
$Age             = check_input($_POST['Age']);
$Sex             = check_input($_POST['Sex']);
$Status          = check_input($_POST['Status']);
$Employment      = check_input($_POST['Employment']);
$Income          = check_input($_POST['Income']);
$pairs_flats     = check_input($_POST['pairs_flats']);
$color_flats     = check_input($_POST['color_flats']);
$size_flats      = check_input($_POST['size_flats']);
$material_flats  = check_input($_POST['material_flats']);
$brand_flats     = check_input($_POST['brand_flats']);
$frequency_flats = check_input($_POST['frequency_flats']);
$cost_flats      = check_input($_POST['cost_heels']);
$pairs_heels     = check_input($_POST['pairs_heels']);
$color_heels     = check_input($_POST['color_heels']);
$size_heels      = check_input($_POST['size_heels']);
$material_heels  = check_input($_POST['material_heels']);
brand_heels      = check_input($_POST['brand_heels']);
$frequency_heels = check_input($_POST['frequency_heels']);
$cost_heels      = check_input($_POST['cost_heels']);
$height_heels    = check_input($_POST['height_heels']);
$work            = check_input($_POST['work']);
$mall            = check_input($_POST['mall']);
$events          = check_input($_POST['events']);
$travel          = check_input($_POST['travel']);


/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $Email))
{
    show_error("E-mail address not valid");
}

/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
    $website = '';
}

/* Let's prepare the message for the e-mail */
$message = "Hello!

Your form has been submitted by:

Name: $Name
Address: $Address
Email: $Email
Age: $Age
Sex: $Sex
Status: $Status
Employment: $Employment
Income: $Income


FLATS
Pairs: $pairs_flats pairs
Color: $check_msg
Size: $size_flats
Material: $material_flats
Brand: $brand_flats
Frequency: $frequency_flats pairs a year
Cost: Php $cost_flats


HEELS
Pairs: $pairs_heels pairs
Color: $color_heels
Size: $size_heels
Material: $material_heels
Brand: $brand_heels
Frequency: $frequency_heels pairs a year
Cost: $cost_heels
Height: $height_heels inches


Work/School: $work
Mall: $mall
Events: $events
Travel: $travel


End of message
";

/* Send the message using mail() function */
mail($myEmail, $subject, $message);

/* Redirect visitor to the thank you page */
header('Location: thanks.html');
exit();

/* Functions we used */
function check_input($data, $problem='')

    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
        show_error($problem);
    }
        return $data;
}

function show_error($myError)
{
?>
    <html>
    <body>

        <b>Please correct the following error:</b><br />
        <?php echo $myError; ?>

    </body>
    </html>
<?php
exit();
}
?>

I’ve tried all sorts of codes like implode, if statements, foreach etc.. cant seem to get it right…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:30:15+00:00Added an answer on June 8, 2026 at 6:30 pm
    $color_flats = check_input(implode("," , $_POST['color_flats']));
    
    $message = "...
    
    FLATS
    Pairs: $pairs_flats pairs
    Color: $color_flats
    
    
    ...";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to retrieve the id column of records that have their checkboxes selected in
Currently I am trying to check a selected Item Id and display in dropdown
I'm new with vim's taglist plugin and have a question regarding display style of
My code below is supposed to display each question ($_POST[questionText]). For each question, it
This compojure question is twofold! How can I display an image object in a
Please excuse my newbie Question. I'm tryin to display data from a mysql table
This is a followup on the question: ASP.NET next/previous buttons to display single row
Very simple question... I have an array of pixels, how do I display them
string in question: '{images:{0:<div style=\\background:red;width:250px;height:250px;display:block;position:absolute;\\></div>}}' I've tried various combinations of single and double quotes.
I'm building text balloons to display variable length messages in Flash. My question is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.