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 7836539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:12:03+00:00 2026-06-02T14:12:03+00:00

i have some understanding difficulties. i have some checkboxes in html like this: <input

  • 0

i have some understanding difficulties. i have some checkboxes in html like this:

<input type="checkbox" name="a[]" value="1">
<input type="checkbox" name="a[]" value="2">
<input type="checkbox" name="a[]" value="3">

i like to evaluate multiple choices of a[] to see what was selected thats why i have to use an array.

okay, now the problem is: after submit i have posted that array.

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

    $a = $_POST['a'];
}

further i like to set some message into another array for each value that is selected:

if ($a === '1'){
   $msg[] = "text1";
}
if ($a === '2'){
   $msg[] = "text2";
} and so on...

now i have stored these messages to the array $msg[]

the next step and here comes my real problem:

i like to display the whole selection in a mail that will be send. so up to that point i have:

$to = "a@b.cd";
$subject = "some text";
$message = "some text... 

show what was selected:

$msg

end text";...

so normally i know that i have to use foreach like:

<?php if(isset($msg)):?>
    <?php foreach($msg as $m):?> 
        <p>
        <?php echo $m;?>
        </p>
    <?php endforeach;?>
<?php endif;?>

to make it visible. my problem is to implement this into that message from the mail into that quotation marks.

so if there is someone who could help me out, i really would appreciate.

thanks a lot.

  • 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-02T14:12:04+00:00Added an answer on June 2, 2026 at 2:12 pm

    Simply use string concatenation, which in PHP is done using the . (dot) operator.

    $message = "some text... \n\nshow what was selected:\n\n";
    
    foreach ($a as $b)
    {
        $message .= $b . "\n";
    }
    
    $message .= "end text";
    

    Furthermore you should look into your variable naming ($a isn’t really descriptive), and $a is an array, so you can’t do if ($a === '1'), you should use in_array().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning JPA from this tutorial . I have some confusions in understanding
I have some perl code that looks something like this: my @array = map
I am new to WCF and I have some difficulties understanding certain things... I
I have some trouble understanding this one so here it is. I'm trying to
I have some difficulties understanding how Boost.MultiIndex is implemented. Lets say I have the
I thought that i have some good understanding of Java generics. This code DOES
i now this is a silly question, but i still have some poor understanding
I have some difficulties in understanding if-then-else conditionals in regular expressions. After reading If-Then-Else
I have some difficulties in understanding a function Win32_AllocatedResource() and its fields antecedent and
I'm working with gcc 4.4.5, and have some difficulties in understanding the right shift

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.