Solved

php formating html table cell

Posted on 2011-09-14
5
301 Views
Last Modified: 2012-05-12
I need some help with formatting a HTML table cell in an HTML email created in a php script. What I want is a list of number aligned in the table cell vertically. What I get is a list of numbers  all in one line in the cell.

 
// email.
    $to = "someone@gmail.com";
    $from = "root@me.com";
    $subject = "Hello! This is HTML email";

    //begin of HTML message
     
$message ='<html>
  <body bgcolor="#DCEEFC">
    <center>
        <b> I am reciving HTML email......</b> <br>
        <font color="red">Thanks !</font> <br>
        <?=$IMEI?>
    </center>
      <table border="1">
<tr>
<td >';
 while ($line =  mysql_fetch_assoc($result)) {
     	
     	$message .=    $line['num']. " \n";
     	
     }
$message.= '</td>

</tr>
</table> 
  </body>
</html>';

   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

   
    
    // now lets send the email.
    mail($to, $subject, $message, $headers);

    echo "Message has been sent....!";

Open in new window

0
Comment
Question by:pointhigh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 6

Accepted Solution

by:
bartvd earned 425 total points
ID: 36538891
You should replace this line:
$message .=    $line['num']. " \n";

in this line:
$message .=    $line['num']. "<br />";
0
 
LVL 53

Expert Comment

by:Huseyin KAHRAMAN
ID: 36538921
you can also use <li>

$message .=    "<li>" .$line['num'];
0
 
LVL 10

Assisted Solution

by:stu215
stu215 earned 25 total points
ID: 36539022
-> you can also use <li>
->
-> $message .=    "<li>" .$line['num'];

Dont forget to close the <li>...</li> ::

$message .=    "<li>".$line['num']."</li>";
0
 
LVL 53

Assisted Solution

by:Huseyin KAHRAMAN
Huseyin KAHRAMAN earned 50 total points
ID: 36539492
actually we should include <ol>...<ol> or <ul>...</ul> too :)

$message.= '<ul>';
while ($line =  mysql_fetch_assoc($result)) {
  $message .=    "<li>".$line['num']."</li>"." \n";
}
$message.= '</ul>';

for lines: 18-22
0
 

Author Closing Comment

by:pointhigh
ID: 36542695
This worked great! Thanks!
I tested everyone’s solution and they all worked. Bartvd solution was the closest to what I was looking for.
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

736 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question