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

  • Home
  • SEARCH
  • 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 8822921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:13:39+00:00 2026-06-14T06:13:39+00:00

I need help with this if any can show me, that would be so

  • 0

I need help with this if any can show me, that would be so great and helpful.

I am trying to get more then one value show up through a checkbox, with this information in PHP has been sent to an email. I can get anyone on the selected list work individually when applied

This is my PHP & HTML code, it all works fine, it’s just the program will only send one of the selected list, even if I select more then one.

$ch1, $ch2, $ch3, $ch4 ,$ch5

PHP

<?php
if(isset($_POST['email'])) {

    $email_to = "";
    $email_subject = "";


    function died($error) {
        // Error Code
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['firstname']) ||
        !isset($_POST['lastname']) ||
        !isset($_POST['checkboxes']) ||
        !isset($_POST['gender']) ||
        !isset($_POST['email']) ||
        !isset($_POST['subject']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['message'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }

    $firstname = $_POST['firstname']; // required
    $lastname = $_POST['lastname']; // required
    $ch1 = 'unchecked'; // required
    $ch2 = 'unchecked'; // required
    $ch3 = 'unchecked'; // required
    $ch4 = 'unchecked'; // required
    $ch5 = 'unchecked'; // required
    $male_status = 'unchecked'; // required
    $female_status = 'unchecked'; // required
    $email_from = $_POST['email']; // required
    $subject = $_POST['subject']; // required
    $telephone = $_POST['telephone']; // required
    $message = $_POST['message']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$firstname)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$lastname)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$subject)) {
    $error_message .= 'The Subject you entered does not appear to be valid.<br />';
  }

  if (isset($_POST['checkboxes'])) {

    $selected_checkboxes = $_POST['checkboxes'];

    if (isset($_POST['ch1'])) {
        $ch1 = $_POST['checkboxes'];

        if ($ch1 == 'googlechrome') {
            $ch1 = 'checked';
        }
    }

    if (isset($_POST['ch2'])) {
        $ch2 = $_POST['checkboxes'];

        if ($ch2 == 'firefox') {
            $ch2 = 'checked';
        }
    }

    if (isset($_POST['ch3'])) {
        $ch3 = $_POST['checkboxes'];

        if ($ch3 == 'safari') {
            $ch3 = 'checked';
        }
    }

    if (isset($_POST['ch4'])) {
        $ch4 = $_POST['checkboxes'];

        if ($ch4 == 'internetexplorer') {
            $ch4 = 'checked';
        }
    }

    if (isset($_POST['ch5'])) {
        $ch5 = $_POST['checkboxes'];

        if ($ch5 == 'opera') {
            $ch5 = 'checked';
        }
    }
}

  if (isset($_POST['gender'])) {

    $selected_radio = $_POST['gender'];

        if ($selected_radio == 'male') {
            $male_status = 'checked';

        }
        else if ($selected_radio == 'female') {
            $female_status = 'checked';
        }
    }
  if(strlen($message) < 2) {
    $error_message .= 'The Message you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "First Name: ".clean_string($firstname)."\n";
    $email_message .= "Last Name: ".clean_string($lastname)."\n";
    $email_message .= "Gender: ".clean_string($selected_radio)."\n";
    $email_message .= "Telephone: ".clean_string($telephone).
"\n";
    $email_message .= "Email: ".clean_string($email_from).
"\n";
    $email_message .= "Subject: ".clean_string($subject).
"\n";
$email_message .= "Browsers Used: ".clean_string($selected_checkboxes)."\n";
    $email_message .= "Message: ".clean_string($message).
"\n";


// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

Thank you for contacting us. We will be in touch with you very soon.

<?php
}
?>

HTML

<form id="contact" name="contact" action="contact.php" method="post">
  <p>
    <label for="firstname">First Name *<br>
    </label>
    <input  type="text" name="firstname" maxlength="50" size="30" id="firstname" placeholder="First Name" required autofocus>
    <label for="lastname"><br>
      <br>
      Last Name *<br>
    </label>
    <input  type="text" name="lastname" maxlength="50" size="30" id="lastname" placeholder="Last Name" required>
    <label for="email"><br>
      <br>
      Email Address *<br>
    </label>
    <input  type="text" name="email" maxlength="80" size="30" id="email" placeholder="example@domain.com" required>
    <label for="telephone"><br>
      <br>
      Telephone <br>
    </label>
    <input  type="text" name="telephone" maxlength="30" size="30" id="subject" placeholder="Phone Number" required>
    <br>
    <br>
    <label for="subject">Subject *</label>
    <br>
  <input type="text" name="subject" maxlength="30" size="30" id="subject" placeholder="Hello" required>
    <br>
    <br>
    <Input type = "Radio" Name ="gender" value= "Male">Male
  <Input type = "Radio" Name ="gender" value= "Female" >Female
  <br>
  </p>
  <p>&quot;What browser are you using, to view this website&quot;<br>
    <Input type = "Checkbox" Name ="checkboxes" value="Google Chrome">Google Chrome
    <Input type = "Checkbox" Name ="checkboxes" value="Firefox">Firefox
    <Input type = "Checkbox" Name ="checkboxes" value="Safari">Safari
    <Input type = "Checkbox" Name ="checkboxes" value="Internet Explorer" >Internet Explorer
    <Input type = "Checkbox" Name ="checkboxes" value="Opera" >Opera
    <br>
    <br>
    Message *<br>
    </label>
    <textarea  name="message" maxlength="1000" cols="90" rows="6" id="message" placeholder="Type message here" required></textarea>
    <br>
    <input type="submit" value="Submit">
  </p>
</form>
  • 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-14T06:13:39+00:00Added an answer on June 14, 2026 at 6:13 am
    <Input type = "Checkbox" Name ="checkboxes[]" value="Google Chrome">Google Chrome
    <Input type = "Checkbox" Name ="checkboxes[]" value="Firefox">Firefox
    <Input type = "Checkbox" Name ="checkboxes[]" value="Safari">Safari
    <Input type = "Checkbox" Name ="checkboxes[]" value="Internet Explorer" >Internet Explorer
    <Input type = "Checkbox" Name ="checkboxes[]" value="Opera" >Opera
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can any body help me on separating this example of data that i need
I need some drawings in my tableview. How can i do this. Any help
I need help finishing this statement. It is frustrating that two of the PHP
I really need help on this one. I am having a simple login form
Okay, I need some help here. This is the same old "can't use an
I really need help this time - Joomla 2.5 and latest K2. I'm using
i need help with this. I'am using JQuery's Dynamic Form plug-in, it duplicates my
I really need help with this last part of my program. I need to
I Really need help in this ... I'm building an application where I need
I am new to android and need help on this. I have two views

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.