So i am trying to send confirmation of an order via email. To do this i need to attach the body as a variable which is $body
So i have all my html code inside the $body. That part works great and it emails successfully.
However i need to loop out what ever was ordered so the customer knows what they ordered and what they paid for each item.
So here is the SQL query
// GET THE PRODUCTS THAT HAVE BEEN ORDERED
$w="SELECT
nfw_order_new_items.name,
nfw_order_new_items.qty,
nfw_order_new_items.price
FROM
nfw_order_new_items
WHERE
nfw_order_new_items.id_order = '$order_ID'";
$ww= mysql_query("$w") or die("Inv Rows ".mysql_error());
Then the body as an example, has my html in it. The $name, $qty and $price are where i want my loop to create the rows of the table depending on how many in the result. I have tried putting the loop outside body like below, but that doesnt work either. See below:
while(list($name,$qty,$price)= mysql_fetch_row($ww)){
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>
<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>
</table>"; }
You dont need to print the table header each time
you can do it like below
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>";
while(list($name,$qty,$price)= mysql_fetch_row($ww))
{
$body .= "<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>";
}
$body .= "</table>";
Try this code.
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>";
while(list($name,$qty,$price)= mysql_fetch_row($ww)){
$body .= "<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>
"; }
$body.="</table>";
Related
I am using codeigniter.I have a table in my view. When one row is filled totally that data must be posted to my controller class. How to do this.
My view page.
<table style=" border-collapse: collapse;">
<tr>
<th>Employee</th>
<th>Start Time</th>
<th>ID</th>
<th>Mins</th>
<th>Type</th>
</tr>
<tr id="1">
<td contenteditable="true"><?php echo form_dropdown('employee', $options_category, set_value('employee'),'style="border-radius:0px; height:15px; font-size:10px; width:70px"');?></td>
<td contenteditable="true"><?php echo $date->format( 'H:i' ); ?></td>
<td contenteditable="true" ondblclick="mylist()"><?=$products['id']?></td>
<td contenteditable="true" class="nr"><?=$products['mins']?></td>
<td contenteditable="true"><?=$products['type']?></td>
</tr>
<tr id="2">
<td contenteditable="true"><?php echo form_dropdown('employee', $options_category, set_value('employee'),'style="border-radius:0px; height:15px; font-size:10px; width:70px"');?></td>
<td contenteditable="true"></td>
<td contenteditable="true" ondblclick="mylist()"><?=$products['id']?></td>
<td contenteditable="true"></td>
<td contenteditable="true"></td>
</tr>
</table>
I need to post the id that is filled totally.How to do this can someone help me code?
I am using PHP mail() function to send the email. I have a table in the email with specific styles, but when I receeve the email, it does not show me the images and all style is disturbed.
My code is below:
$recipient = $_POST['Users']['email'];
$name = $_POST['Users']['first_name'];
$username = $_POST['Users']['username'];
$password = $_SESSION['password'];
$referrer_name = $model->referrer = $referrer_data['first_name'];
$referrer_email = $model->referrer = $referrer_data['email'];
// print_r($referrer_name);
// print_r($referrer_email);
$webstore = $this->base_url . "/" . Yii::app()->session['username'];
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$subject = "Sign Up- Success";
$message = "<table width='700' border='0' align='center' cellpadding='0' cellspacing='0' class='bordermain'>
<tr>
<td align='center' valign='middle'> </td>
</tr>
<tr>
<td align='center' valign='middle'><table width='666' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='666' colspan='2' align='center' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='50%' align='left' valign='middle'><img src='".$this->theme_baseurl."/images/karmora-websiteLogo.png' width='175' height='50' alt=''/></td>
<td width='50%' align='right' valign='middle'><table width='120' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='30' align='center' valign='middle'><a href='http://www.facebook.com/' target='_blank'><img src='".$this->theme_baseurl."/images/facebook.jpg' alt='Facebook' width='25' height='25' title='Facebook'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.twitter.com/' target='_blank'><img src='".$this->theme_baseurl."/images/twitter.jpg' alt='Twitter' width='25' height='25' title='Twitter'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.pinterest.com/' target='_blank'><img src='".$this->theme_baseurl."/images/pintrest.jpg' alt='Pinterest' width='25' height='25' title='Pinterest'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.youtube.com/' target='_blank'><img border='0' width='25' height='25' src='".$this->theme_baseurl."/images/youtube.jpg' alt='YouTube'/></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='left' valign='middle'> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='5'>
<tr>
<td align='center' valign='middle' bgcolor='#f9f9f9' style='border:1px solid #CCC;'><table width='99%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><span class='mainheading'><strong>Congratulations</strong></span></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top' bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='20' align='center' valign='middle'></td>
</tr>
<tr>
<td align='center' valign='middle' class='bodytext'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' style='border-top:2px solid #FF7D0F'> </td>
</tr>
<tr>
<td align='left' valign='middle' class='bodytext'><p class='headingpink'><strong>Dear '$name'</strong></p>
<p>Congratulations on your decision to become the newest member of <strong>'$referrer_name' </strong>Karmora Community!</p>
<p>Below you will find important information about your new Karmora Webstore. Please print or save this email in a safe location for future reference.</p>
<table width='400' border='0' cellspacing='0' cellpadding='5'>
<tr>
<td width='144'><strong><span class='bodytext'>Karmora URL</span></strong></td>
<td width='256'><strong><span class='bodytext'><a href='#'>'$webstore'</a></span></strong></td>
</tr>
<tr>
<td><strong><span class='bodytext'>User Name</span></strong></td>
<td><strong><span class='bodytext'>'$username'</span></strong></td>
</tr>
<tr>
<td><strong><span class='bodytext'>Password</span></strong></td>
<td><strong><span class='bodytext'>'$password'</span></strong></td>
</tr>
</table>
<p>Now it's time for you to start building your own personal Karmora Community where you can make money off the memberships and purchases of your Community members! Let’s get this party started!</p>
<p class='headingpink'><strong>7 BABY STEPS TO GOOD KARMORA™:</strong></p>
<ol>
<li>Click on your Karmora URL and log in to your back office to customize your Webstore. You will see 'Log In' in the upper right hand corner of your Webstore.</li>
<li>Click on the Profile button and upload your picture while in the profile section. We recommend recent pictures. Your customers will want to know that it is your Webstore!</li>
<li>Go to the Training Section and watch the Instructional Videos. You will find all kinds of information to help you with your Karmora Webstore. </li>
<li>Click on the eWallet button and create your eWallet. Instructions on how to do this are found in the Training Section of your back office.</li>
<li>Use Go Daddy to secure a domain name for your new Webstore and point the new domain to your Karmora Webstore URL above. Instructions on how to do this are found in the Training Section of your back office </li>
<li>Make your first official Karmora purchase.</li>
<li>Start sharing your new Webstore with everyone you speak to so they can begin a Karmora Community of their own. Once you have five active members in your Karmora Community your Webstore is basically FREE!</li>
</ol>
<p>If you have any questions please don’t hesitate to contact <strong>'$referrer_name' </strong>by email at <a href='mailto:$referrer_email'>'$referrer_email'</a> or simply <u><a href='http://karmora.com/liveSupport'>click here</a></u> to chat with a Good Karmora™ Specialist seven days a week from 7am to 7pm Pacific Time. </p>
<p>As always we wish you Good Luck, Good Fortune and Good Karmora™! </p>
<p> </p>
</td>
</tr>
<tr>
<td align='left' valign='middle' style='border-bottom:2px solid #FF7D0F'> </td>
</tr>
</table></td>
</tr>
<tr>
<td align='center' valign='middle' class='bodytext'> </td>
</tr>
</table></td>
</tr>
<tr>
<td width='50%' height='70' align='center' valign='middle' bgcolor='#000000' class='footertextwhite' style='border-top:2px solid #de3277; border-bottom: 2px solid #de3277'><table width='90%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='40' align='left' valign='middle'><a href='http://karmora.com/contact' class='a1'>Contact Us<br />
</td>
</tr>
</table></td>
<td width='50%' height='70' align='center' valign='middle' bgcolor='#000000' class='footertextwhite' style='border-top:2px solid #de3277; border-bottom: 2px solid #de3277'><table width='90%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='40' align='right' valign='middle'><a href='http://www.karmora.com/liveSupport/'><img src='".$this->theme_baseurl."/images/live_support_icon_03.png' width='110' height='32' /></a><br />
<span class='footertext'>© 2013 Karmora</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top'> </td>
</tr>
</table></td>
</tr>
</table>";
mail($recipient, $subject, $message,$headers);
You can put your styles inline in your elements
<p style="color:#000">...</p>
And you should use the PHP header
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
The reason you cannot use css other than inline and you are best advised to use table based layouts is that some if not most of the email clients such as outlook for example have VERY VERY old version of the browser embeded in them to show an html email.
So unfortunately all email has to be created like we were back in the days of IE6 or before.
As to your images not showing that is because you have to remember when the email is being read it is not a page on your website, so any images must have a fully defined domain and path like src="http://www.yoursite.net/images/facebook.jpg
This is my email.php page coding. My php email function code working perfectly. I'm faced a small problem here. I didn't get the database records inside the while($t_row = mysql_fetch_array($tariff_query)){}. But, it send the remaining records from database correctly. How to send the database records of inside the while($t_row = mysql_fetch_array($tariff_query)){}?
include("config.php");
if(isset($_GET["id"]))
{
$id = mysql_real_escape_string($_GET["id"]);
$query = mysql_query("SELECT * FROM ebvouchers WHERE VoucherID = $id");
$row = mysql_fetch_object($query);
echo mysql_error();
$tariff_query = mysql_query("SELECT * FROM ebvouchertariffs WHERE VoucherID_Fk = $id");
$strMessage = "<table width=1200 align=center cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
<tr>
<td width=1026 height=8 colspan=2> </td>
</tr>
<tr>
<td colspan=8>
<table class=glow width=1070 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=40 colspan=4 style=border-radius: 5px 5px 0px 0px; class=headdetail>GUEST DETAILS </td>
</tr>
<tr>
<td width=263 height=10 class=detailsfont> </td>
<td width=228> </td>
<td width=239 class=detailsfont> </td>
<td width=340> </td>
</tr>
<tr>
<td height=40 class=detailsfont>Voucher ID :</td>
<td width=228 class=fetchfont>$row->VoucherID</td>
<td width=239 class=detailsfont>Voucher Reference Number :</td>
<td width=340 class=fetchfont>$row->VoucherReference</td>
</tr>
//some codes
//some codes
//some codes
//some codes
//some codes
//some codes
//some codes
<tr>
<td colspan=4>
<table class=myborder width=1050 border=0 align=center cellpadding=10 cellspacing=0>
<tr>
<td width=70 height=40 class=tarifffont>Serial No</td>
<td width=130 class=tarifffont>Date</td>
<td width=250 class=tarifffont>Particulars</td>
<td width=100 class=tarifffont>No of Nights</td>
<td width=100 class=tarifffont>Rate</td>
<td width=100 class=tarifffont>Price</td>
<td width=100 class=tarifffont>Tax %</td>
</tr>";
while($t_row = mysql_fetch_array($tariff_query))
{
"<tr>
<td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
<td class=insidetariff>". $t_row['TariffDate'] ."</td>
<td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
<td class=insidetariff>". $t_row['NoOfNights'] ."</td>
<td class=insidetariff>". $t_row['TariffRate'] ."</td>
<td class=insidetariff>". $t_row['TariffPrice'] ."</td>
<td class=insidetariff>". $t_row['TariffTax'] ."</td>
</tr>";
}
"<tr>
<td height=40 colspan=2 class=detailsfont>Total Price (Overall Price) : </td>
<td height=20 colspan=2 class=tarifffont>$tt_row->TariffAddTotal</td>
<td height=20 class=insidetariff>Net Total (Overall Tax) : </td>
<td height=20 colspan=2 class=tarifffont>$tt_row->TariffNetTotal</td>
</tr>
<tr>
<td height=20 colspan=7 class=detailsfont> </td>
</tr>
<tr>
<td height=40 colspan=5 class=detailsfont>Final Amount : </td>
<td height=40 colspan=2 class=tarifffont>$tt_row->TariffFinalTotal</td>
</tr>
</table></td>
</tr>
<td colspan=4> </td>
</table>
</td>
</tr>";
}
You must append the data to the string. So the code will be like this:
while ($t_row = mysql_fetch_array($tariff_query)) {
$strMessage .= "<tr>
<td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
<td class=insidetariff>". $t_row['TariffDate'] ."</td>
<td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
<td class=insidetariff>". $t_row['NoOfNights'] ."</td>
<td class=insidetariff>". $t_row['TariffRate'] ."</td>
<td class=insidetariff>". $t_row['TariffPrice'] ."</td>
<td class=insidetariff>". $t_row['TariffTax'] ."</td>
</tr>";
}
$strMessage .= "<tr>
<td height=40 colspan=2 class=detailsfont>Total Price (Overall Price)....
Also, use of mysql_* functions is deprecated and will be removed in the future. You should use mysqli_* functions now.
You going wrong way.First assign while loop data to variable then add to mail message like this:
$tbl = '';
while($t_row = mysql_fetch_array($tariff_query))
{
$tbl .= "<tr>
<td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
<td class=insidetariff>". $t_row['TariffDate'] ."</td>
<td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
<td class=insidetariff>". $t_row['NoOfNights'] ."</td>
<td class=insidetariff>". $t_row['TariffRate'] ."</td>
<td class=insidetariff>". $t_row['TariffPrice'] ."</td>
<td class=insidetariff>". $t_row['TariffTax'] ."</td>
</tr>";
}
while now on you message add this variable like this :
$strMessage = "<table>.....".$tbl."....";
You are not concatenating the string for variable $strMessage.
In while loop you should concate string with your variable and at last echo it.
Store data calculated inside the while loop as :
while($t_row = mysql_fetch_array($tariff_query))
{
$strMessage .= "<tr>
<td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
<td class=insidetariff>". $t_row['TariffDate'] ."</td>
<td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
<td class=insidetariff>". $t_row['NoOfNights'] ."</td>
<td class=insidetariff>". $t_row['TariffRate'] ."</td>
<td class=insidetariff>". $t_row['TariffPrice'] ."</td>
<td class=insidetariff>". $t_row['TariffTax'] ."</td>
</tr>";
}
And also assign string after while loop to $strMessage :
$strMessage .= "<tr>
<td height=40 colspan=2 class=detailsfont>Total Price (Overall Price) : </td>
<td height=20 colspan=2 class=tarifffont>$tt_row->TariffAddTotal</td>
<td height=20 class=insidetariff>Net Total (Overall Tax) : </td>
<td height=20 colspan=2 class=tarifffont>$tt_row->TariffNetTotal</td>
</tr>
<tr>
<td height=20 colspan=7 class=detailsfont> </td>
</tr>
<tr>
<td height=40 colspan=5 class=detailsfont>Final Amount : </td>
<td height=40 colspan=2 class=tarifffont>$tt_row->TariffFinalTotal</td>
</tr>
</table></td>
</tr>
<td colspan=4> </td>
</table>
</td>
</tr>";
I'm trying to figure out how to apply attributes to my table via php email. I can't get the background and and rowspan to work. Can't figure it out.
$to = 'XXXXX';
$subject = 'New Homeless Connection';
$msg = "<html>
<head>
<title>New Homeless Connection</title>
</head>
<body>
<table cellspacing=\"0\" cellpadding=\"10\" border=\"1\" align=\"left\">
<tr>
<td align=\"left\" width=\"150px\" background=\"#EEEEEE\">Registery No.:</td>
<td align=\"left\"> $reg</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">First Name:</td>
<td align=\"left\">$first_name </td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Connection Date:</td>
<td align=\"left\"$>$connect_date</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Probability:</td>
<td align=\"left\"$>$prob</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Volunteer Name:</td>
<td align=\"left\"$><strong>$hv_name</strong></td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Volunteer Phone:</td>
<td align=\"left\"$><strong>$hv_phone</strong></td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Consent Form:</td>
<td align=\"left\"$>$consent</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Field Count:</td>
<td align=\"left\"$>$reg_count</td>
</tr>
<tr>
<td align=\"left\" rowspan=\"2\">http://wwww.41q.org/admin/</td>
</tr>
</table>
</body>
</html>
";
A few things about tables:
You don't use "px" to define the width/height. Should just be width="150"
The background attribute should be bgcolor, and it doesn't use #. Just set bgcolor="eeeeee"
Why do you have $'s like this? <td align=\"left\"$> . Those shouldn't be there.
The rowspan is OK, but it's not doing anything because there is no row below it. I'm not sure what you are trying to do with the rowspan.
rowspan should be colspan, as your table has two columns all the way down except for the last row (whose cell needs to span both columns).
Also, background should be bgcolor.
I've posted up a sample with the replacement here: http://jsfiddle.net/8ymMh/4/
The gridlines show the last cell spanning both columns and the background colours come through OK.
I freely admit to have taken onboard AndrewR's suggestion of removing the hash from in front of the colour name (eeeeee) so all credit to him for that.
I'm trying to echo data from an SQLdatabase into a table that is somewhat decent-looking. I can already echo the data properly into 5 separate basic tables, but when I can't figure out how to style it without it completely messing up. Here is the code I already have:
// OUTPUTS RESULTS //
$resultfirst = mysql_query("SELECT * FROM Students WHERE FirstPeriod='$_POST[firstperiod]'");
$resultsecond = mysql_query("SELECT * FROM Students WHERE SecondPeriod='$_POST[secondperiod]'");
$resultthird = mysql_query("SELECT * FROM Students WHERE ThirdPeriod='$_POST[thirdperiod]'");
$resultfourth = mysql_query("SELECT * FROM Students WHERE FourthPeriod='$_POST[fourthperiod]'");
$resultfifth = mysql_query("SELECT * FROM Students WHERE FifthPeriod='$_POST[fifthperiod]'");
// 1st PERIOD
echo "<table border='1' bgcolor='#3b5998' style='float:left; margin:20'>
<tr>
<th>First Period</th>
</tr>";
while($row = mysql_fetch_array($resultfirst))
{
echo "<tr>";
echo "<td>" . $row['StudentName'] . "</td>";
echo "</tr>";
}
echo "</table>";
// 2nd PERIOD
echo "<table border='1' bgcolor='#3b5998' style='float:left; margin:20'>
<tr>
<th>Second Period</th>
</tr>";
while($row = mysql_fetch_array($resultsecond))
{
echo "<tr>";
echo "<td>" . $row['StudentName'] . "</td>";
echo "</tr>";
}
echo "</table>";
// 3rd PERIOD
echo "<table border='1' bgcolor='#3b5998' style='float:left; margin:20'>
<tr>
<th>Third Period</th>
</tr>";
while($row = mysql_fetch_array($resultthird))
{
echo "<tr>";
echo "<td>" . $row['StudentName'] . "</td>";
echo "</tr>";
}
echo "</table>";
// 4th PERIOD
echo "<table border='1' bgcolor='#3b5998' style='float:left; margin:20'>
<tr>
<th>Fourth Period</th>
</tr>";
while($row = mysql_fetch_array($resultfourth))
{
echo "<tr>";
echo "<td>" . $row['StudentName'] . "</td>";
echo "</tr>";
}
echo "</table>";
// 5th PERIOD
echo "<table border='1' bgcolor='#3b5998' style='float:left; margin:20'>
<tr>
<th>Fifth Period</th>
</tr>";
while($row = mysql_fetch_array($resultfifth))
{
echo "<tr>";
echo "<td>" . $row['StudentName'] . "</td>";
echo "</tr>";
}
echo "</table>";
If the code above is unclear- my goal is to compare the first period teachers in which are stored in the database, and output the students names that share the same period/teacher.
This code works fine. But the tables look very bland. I would like to echo the data into a table such as this.
<table width="368" border="0" cellspacing="0" cellpadding="2" align="center" height="100">
<tr valign="middle">
<td bgcolor="#000066" width="120" height="20">
<div align="center"><font color="#FFFFFF"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Web
Services</font></b></font> </div>
</td>
<td width="4" height="20"></td>
<td bgcolor="#990000" width="120" height="20">
<div align="center"><font color="#FFFFFF"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Web
Products</font></b></font></div>
</td>
<td width="4" height="20"></td>
<td bgcolor="#C89800" width="120" height="20">
<div align="center"><font color="#FFFFFF"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Web
Resources</font></b></font> </div>
</td>
</tr>
<tr valign="top">
<td bgcolor="#000066" width="120">
<table width="100%" border="0" cellspacing="0" cellpadding="3" height="80">
<tr bgcolor="#FFFFFF" valign="top">
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Professional
and cost effective web design, development and promotion services
</font></p>
</td>
</tr>
</table>
</td>
<td width="4"></td>
<td bgcolor="#990000" width="120">
<table width="100%" border="0" cellspacing="0" cellpadding="3" height="80">
<tr bgcolor="#FFFFFF" valign="top">
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Interactive
Web Products - Flash Survey, poll, Guest book, Instant Quote
</font></p>
</td>
</tr>
</table>
</td>
<td width="4"></td>
<td bgcolor="#C89800" width="120">
<table width="100%" border="0" cellspacing="0" cellpadding="3" height="80">
<tr bgcolor="#FFFFFF" valign="top">
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Free
web resources - articles, tutorials, tips and tricks.
</font></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
If anyone can offer any suggestions of any sort- I would greatly appreciate it.
I see a few areas that can be improved:
As others have said, don't use tables to manage layout. However, tables are perfectly acceptable for displaying tabular data
You really want to use CSS to style your page, it's a lot easier to control your style and makes the markup easier to read. See this w3schools' artcile on CSS Tables
You can combine your multiple queries into one for better performance (though, that seems to be outside the scope of your question)
Here is an example markup and CSS for your table: http://jsfiddle.net/vxzJV/