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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:42:05+00:00 2026-06-14T13:42:05+00:00

I have the following PHP. Here I am creating a table, looping through the

  • 0

I have the following PHP. Here I am creating a table, looping through the keys and values of my incoming data, adding them to the rows. When receiving the mail, it is adding random gaps/whitespaces in the inline styles, for example:

see bord er:4px solid #E4F5FD;

<td valign="top" style="padding:5px;border-collapse:collapse;bord er:4px solid #E4F5FD;text-transform:capitalize;font-family:arial;font-size:12px;background:#FFFFFF;">

and

see background:#FFF FFF;

padding:5px;border-collapse:collapse;border:4px solid #E4F5FD;text-transform:capitalize;font-family:arial;font-size:12px;background:#FFF  FFF;color:#888888;

I have no idea why it is doing this, has anyone encountered this problem before?

Please keep in mind I am learning PHP, so be kind.

$data_output .= '<table align="center" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse;background:#E4F5FD;border:0;width:680px;">';

    foreach ($data_html as $key => $value) {

        $data_output .= '<tr>';
        $data_output .= '<td valign="top" style="padding:5px;border-collapse:collapse;border:4px solid #E4F5FD;text-transform:capitalize;font-family:arial;font-size:12px;background:#FFFFFF;"><b>'.str_replace('_',' ',$key).'</b></td>';

        $values = '';
        foreach($value as $v) {
          $values .= $v.'<br />';
        }

        $z = '';
        if($values == ''){
            $z = $value;
        } else {
            $z = $values;
        }

        $data_output .= '<td valign="top" style="padding:5px;border-collapse:collapse;border:4px solid #E4F5FD;text-transform:capitalize;font-family:arial;font-size:12px;background:#FFFFFF;color:#888888;">'.str_replace('_',' ',$z).'</td>';
        $data_output .= '</tr>';
    }

    $data_output .= '</table>';


$from = 'website@bla.clo.uk';
$to = $_POST['email'];
$cc = 'me@bla.co.uk';
$subject = 'bla stuff';
$body = $data_output;

$headers = '';
$headers .= "From: $from\n";
$headers .= "Cc: $cc\r\n";
$headers .= "Reply-to: $from\n";
$headers .= "Return-Path: $from\n";
$headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\n";
$headers .= "Date: " . date('r', time()) . "\n";

if (mail($to, $subject, $body, $headers)){
    echo 'sent';
} else {
    echo 'fail';
    die();
}
  • 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-14T13:42:06+00:00Added an answer on June 14, 2026 at 1:42 pm

    Make sure that each line of content does not exceed 78 characters in length, nor that you exceed 998 continuous characters.

    This was the issue, I added “\n” at the end of each row and cell to break the line content.

    foreach ($data_html as $key => $value) {
            $data_output .=
            '<tr>'."\n".
            '<td style="border:4px solid #DADADA;background:#FFFFFF;text-transform:capitalize;">' . str_replace('_',' ',$key) . '</td>'."\n".
            '<td style="border:4px solid #DADADA;background:#FFFFFF;">' . $value . '</td>'."\n".
            '</tr>'."\n";
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a PHP site and have ran into the following problem, i
I have the following code: <?php include('settings.php'); //Here I have my connection string $result
I have following PHP code $val=<div id=user.$row['cid']. userid=.$row['cid']. class=innertxt><img src=images/images.jpg width=50 height=50><strong>.$uname.</strong><ul> <li>Email: .$row['cemail'].</li>
I have the following PHP code, and for the life of me I can't
I have the following PHP script: <?php $vote_type = $_GET['type']; $book = $_GET['book']; $id
I have the following php code: $k=1; for($i=0; $i < 5; $i++) { $stmt
I have the following php code: $k=1; for($i=0; $i < 5; $i++) { $stmt
I have the following PHP Code #The facebook message $fh = fopen('comments.txt', 'r') or
I have the following PHP script with the working (according to JsonViewer ) JSON
I have the following PHP code // Check if the upload is setted if

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.