Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

php formating html table cell

Posted on 2011-09-14
5
Medium Priority
?
305 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 1700 total points
ID: 36538891
You should replace this line:
$message .=    $line['num']. " \n";

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

Expert Comment

by:HainKurt
ID: 36538921
you can also use <li>

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

Assisted Solution

by:stu215
stu215 earned 100 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 59

Assisted Solution

by:HainKurt
HainKurt earned 200 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

705 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