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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:05:07+00:00 2026-05-29T11:05:07+00:00

$ids = explode(‘,’, $_POST[‘count’]); for($i = 0; $i < count($ids); $i++) { $level =

  • 0
$ids = explode(',', $_POST['count']);
for($i = 0; $i < count($ids); $i++) {
    $level = $_POST['level' . $ids[$i]];
    $institution = $_POST['institution' . $ids[$i]];
    $board = $_POST['board' . $ids[$i]];
    $division = $_POST['division' . $ids[$i]];
    echo "level: " . $level;
    echo " institution: " . $institution;
    echo " board: " . $board;
    echo " division: " . $division;
    echo "<br />";
}

How can I assemble all of the above into a single string: $message = "code here";? I have tried $message = "$ids"; but it’s shows me “Array”. It should send all results to email but it sends only first line of results if I use $message = "level: $level institution: $institution board: $board division: $division";

Example of desired results:

// only sends the first line
level: test1 institution: test2 board: test3 division; test4
level: test10 institution: test20 board: test30 division; test40

I dynamically add, remove and validate form fields in jQuery from the link below http://www.pradipchitrakar.com.np/blog/dynamically-add-remove-textfield.html

<?php

// Contact subject
$subject ="new order "; 

// Details
$message="**cant work out code here for all results to display**";

// Mail of sender
$mail_from="$email";

// From 
$header="from: $name <$email>"; 

// Enter your email address
$to ='test@mail.com'; 

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
  echo "We've recived your contact information";
} else {
  echo "ERROR";
}

?>
  • 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-05-29T11:05:08+00:00Added an answer on May 29, 2026 at 11:05 am

    Email mesages can contain differently formated content. By default they are plaintext. To obtain the effect of line breaks, the best way is to send an HTML formated email. Even better, you could format your data as a table.

    This is the HTML mail example from http://php.net/manual/en/function.mail.php addapted to your snippet:

    <?php
    // multiple recipients
    $to  = 'aidan@example.com' . ', '; // note the comma
    $to .= 'wez@example.com';
    
    // subject
    $subject = 'My data';
    
    // message -> start creatin a table and a nice header
    $message = '
    <html>
      <head>
        <title>My Data</title>
      </head>
      <body>
        <p>Nice message here</p>
        <table>
          <tr>
            <th>Level</th><th>Institution</th><th>Board</th><th>Division</th>
          </tr>';
    $ids = explode(',', $_POST['count']); 
    foreach ($ids as $id) { 
      $level = $_POST['level' . $id]; 
      $institution = $_POST['institution' . $id]; 
      $board = $_POST['board' . $id]; 
      $division = $_POST['division' . $id]; 
      //add each data row to the message as a table row
      $message .= "<tr><td>$level</td><td>$institution</td><td>$board</td><td>$division</td></tr>"; 
    }
    
    //close the html table and page
    $message .= '
      </table>
    </body>
    </html>
    ';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
    $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
    $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
    
    // Mail it
    $send_contact=mail($to,$subject,$message,$headers);                               
    
    // Check, if message sent to your email                                
    if($send_contact){                               
       echo "We've recived your contact information";                               
    } else {                               
       echo "ERROR";                               
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to get all ids separated by comma on one row. id | name
This Works fine and count returns 2: $request_ids=166409183417843,1913616994605; $sent = explode(',',$request_ids); $count = count($sent);
At the moment I have this code: $divisions = explode(,, $mychecklist->dept); foreach($divisions as $division)
Where can I use ids and classes? What is the difference between them? Is
public IList GetClientsByListofID(IList ids) where T : IClient { IList clients = new List();
Given an array of ids $galleries = array(1,2,5) I want to have a SQL
I have 100000 Ids to store into our DataBase. Id is in string format.each
Database row IDs are tied to the URLs like this: The page for row
I want to generate IDs for use with CouchDB. I'd like the IDs to
I am having a lot of IDs and I want to store them for

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.