I trying to make a php code where if someone sign ups in to my website, it will automatically sends the welcome mail (php file). but i could n't able to figure it out how to add the mail-php file/body to the php script whiich says
mail ();
My php script as follows::
<?php
//15 2 2015
session_start();
if(!isset($_SESSION["login"]))
header("location:logout.php");
?>
<?php include('contactus-freelancer.php'); ?>
<?php include('../db.php'); ?>
<?php
$email = $_SESSION['email'];
$to = "$email";
$subject = "Welcome mail";
mail ('''what goes here is my question'''');
echo '';
?>
My mailing script as followsL::
<?php include('home.php'); ?>
<?php
//15 2 2015
session_start();
if(!isset($_SESSION["login"]))
header("location:logout.php");
?>
<?php include('db.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no" /> <!-- disable auto telephone linking in iOS -->
<title>Respmail is a response HTML email designed to work on all major email platforms and smartphones</title>
</head>
<body bgcolor="#E1E1E1" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<center style="background-color:#E1E1E1;">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;">
<tr>
<td align="center" valign="top" id="bodyCell">
<table bgcolor="#E1E1E1" border="0" cellpadding="0" cellspacing="0" width="500" id="emailHeader">
<!-- HEADER ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="10" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // END -->
</table>
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="500" id="emailBody">
<?php
$email = $_SESSION['email'];
$sql = "SELECT * FROM fuser WHERE email = '$email' ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<!--
The centering table keeps the content
tables centered in the emailBody table,
in case its width is set to 100%.
-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="color:#FFFFFF;" bgcolor="#3498db">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<!--
The flexible container has a set width
that gets overridden by the media query.
Most content tables within can then be
given 100% widths.
-->
<table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td align="center" valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<!--
The content table is the first element
that's entirely separate from the structural
framework of the email.
-->
<table border="0" cellpadding="30" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" class="textContent">
<h1 style="color:#FFFFFF;line-height:100%;font-family:Helvetica,Arial,sans-serif;font-size:35px;font-weight:normal;margin-bottom:5px;text-align:center;"><small>Hello <?php echo strtoupper ($row["name"]); ?> </small><br> <br>Welcome to GraduateFreelancers</h1>
<h2 style="text-align:center;font-weight:normal;font-family:Helvetica,Arial,sans-serif;font-size:23px;margin-bottom:10px;color:#205478;line-height:135%;"><small>OUR JOB IS TO FIND YOU A JOB</small></h2>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">GraduateFreelancers is India’s one of the growing online career and recruitment resource with its global essencia technology provides relevant profiles to employers and relevant jobs to job-seekers across industry verticals, experience levels and geographies. Best rated by people have registered on the site over largest Indian network.</div>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<tr mc:hideable>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#F8F8F8">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td align="center" valign="top" width="500" class="flexibleContainerCell">
<table border="0" cellpadding="30" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- CONTENT TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top" class="textContent">
<h3 mc:edit="header" style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;">Thank You</h3>
<div mc:edit="body" style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-left:-25%; margin-bottom:0;color:#5F5F5F;line-height:135%; width:150%;">Let me take this opportunity to thank you for choosing GraduateFreelancers to provide you the finest opportunities and services. We are proud to welcome satisfied freelancers and look forward to many years of working together.<br><br>If you have any questions about our services, we invite you to get in touch with out customaer care available at <i><b>contact#graduatefreelancers.in</b></i>, and we will be happy to assist you 24/7.</div>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" class="flexibleContainerBox">
<table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width: 100%;">
<tr>
<td align="left" class="textContent">
<h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:CENTER; width:130%;">Complete your Profile</h3>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;">We care about your career more than anyone else, which gives us an opportunity to let you know that a complete profile with uploaded CV gets noticed by Recruiters more than the othere who haven't.</div>
</td>
</tr>
</table>
</td>
<td align="right" valign="middle" class="flexibleContainerBox">
<table class="flexibleContainerBoxNext" border="0" cellpadding="0" cellspacing="0" width="210" style="max-width: 100%;">
<tr>
<td align="left" class="textContent">
<h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center; margin-right:-50%; width:180%;">Upload a Profile picture</h3>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:155%; margin-right:-50%; width:180%;">Recruiters get what they see. And now to help them get to know you better, we requerst you to take a bit effort to upload your profile picture.</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr style="padding-top:0;">
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td style="padding-top:0;" align="center" valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="50%" class="emailButton" style="background-color: #3498DB;">
<tr>
<td align="center" valign="middle" class="buttonContent" style="padding-top:15px;padding-bottom:15px;padding-right:15px;padding-left:15px;">
<a style="color:#FFFFFF;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:20px;line-height:135%;" href="www.graduatefreelancers/freelancerssign/" target="_blank">LogIn Here</a>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- MODULE ROW // -->
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td align="center" valign="top" width="500" class="flexibleContainerCell">
<table border="0" cellpadding="30" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- CONTENT TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top" class="textContent">
<h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;">Projects Related to your Streams</h3>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;margin-top:3px;color:#5F5F5F;line-height:135%;">Now let us get to the business. Here are some paid projects recruiters have posted from past two weeks.</div>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- MODULE DIVIDER // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td align="center" valign="top" width="500" class="flexibleContainerCell">
<table class="flexibleContainerCellDivider" border="0" cellpadding="30" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" style="padding-top:0px;padding-bottom:0px;">
<!-- CONTENT TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" style="border-top:1px solid #C8C8C8;"></td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // END -->
<?php
$category1 = $row["category1"];
$sql2 = "SELECT * FROM input WHERE category1 = '$category1' ORDER BY date DESC LIMIT 2";
$result2 = $conn->query($sql2);
if ($result2->num_rows > 0) {
while($row2 = $result2->fetch_assoc()) {
?>
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" class="flexibleContainerBox">
<table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width:100%;">
<tr>
<td align="left" class="textContent">
<h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:10px;margin-bottom:3px;text-align:center; width:130%; margin-left:10%;"><?php echo ($row2["title"]); ?></h3>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%; margin-left:10%;"><?php echo ($row2["description"]); ?></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<?php }
} else {
echo "0 results";
}
?>
<?php
$category2 = $row["category2"];
$sql3 = "SELECT * FROM input WHERE category1 = '$category2' ORDER BY date DESC LIMIT 2";
$result3 = $conn->query($sql3);
if ($result3->num_rows > 0) {
while($row3 = $result3->fetch_assoc()) {
?>
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" class="flexibleContainerBox">
<table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width:100%;">
<tr>
<td align="left" class="textContent">
<h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:10px;margin-bottom:3px;text-align:center; width:130%; margin-left:10%;"><?php echo ($row3["title"]); ?></h3>
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;margin-left:10%;"><?php echo ($row3["description"]); ?></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
<!-- // END -->
<?php }
} else {
echo "0 results";
}
?>
<?php }
} else {
echo "0 results";
}
$conn->close();
?>
<!-- MODULE ROW // -->
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
<tr>
<td valign="top" width="500" class="flexibleContainerCell">
<!-- CONTENT TABLE // -->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" class="flexibleContainerBox" style="background-color:#5F5F5F;">
<table border="0" cellpadding="30" cellspacing="0" width="100%" style="max-width:100%;">
<tr>
<td align="center" class="textContent">
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">How are we doing. Please take a moment to give us your feed back.</div><br>
<h3 style="color:#FFFFFF;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;"><b>FEED BACK</b></h3>
</td>
</tr>
</table>
</td>
<td align="center" valign="top" class="flexibleContainerBox" style="background-color:#27ae60;">
<table class="flexibleContainerBoxNext" border="0" cellpadding="30" cellspacing="0" width="100%" style="max-width:100%;">
<tr>
<td align="center" class="textContent">
<div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">Are we doing good?. Please let your Appreciation reach us.</div><br>
<h3 style="color:#FFFFFF;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;"><b>DONATE</b></h3>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
<!-- // MODULE ROW -->
</td>
</tr>
</table>
</center>
</body>
</html>
NOTE: i have to get the whole mailing script as mail to the user who signs up
Any Suggestions are Appreciated..
Man I'm not sure if you also know what you want, On your question you ask how to send email when a use signs up on your system, but the code you pasted here, have nothing to do with signing up.
From reading the comments, I assume that you want to send an email with html template. I tried to work on your code but it's too long I just did the first 300 lines the rest you can finish it by yourself, here:
<?php
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // set content type to html
$headers = "From: Your System Name <no-reply#your-system.com> \r\n";
$message = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\" width=\"100%\" id=\"bodyTable\" style=\"table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;\" align=\"center\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\" id=\"bodyCell\">";
$message .="<table bgcolor=\"#E1E1E1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" id=\"emailHeader\">";
// HEADER ROW
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
// CENTERING TABLE
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
// FLEXIBLE CONTAINER
$message .= "<table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .="<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
// CONTENT TABLE //
$message .="<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .="<tr>";
$message .="</tr>";
$message .="</table>";
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// FLEXIBLE CONTAINER
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// CENTERING TABLE
$message .="</td>";
$message .="</tr>";
// END
$message .="</table>";
$message .="<table bgcolor=\"#FFFFFF\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" id=\"emailBody\">";
$email = $_SESSION['email'];
$sql = "SELECT * FROM fuser WHERE email = '$email' ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
//CENTERING TABLE
/*
The centering table keeps the content
tables centered in the emailBody table,
in case its width is set to 100%.
*/
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"color:#FFFFFF;\" bgcolor=\"#3498db\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
/* FLEXIBLE CONTAINER
The flexible container has a set width
that gets overridden by the media query.
Most content tables within can then be
given 100% widths.
*/
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
/* CONTENT TABLE // -->
<!--
The content table is the first element
that's entirely separate from the structural
framework of the email.
*/
$message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\" class=\"textContent\">";
$message .="<h1 style=\"color:#FFFFFF;line-height:100%;font-family:Helvetica,Arial,sans-serif;font-size:35px;font-weight:normal;margin-bottom:5px;text-align:center;\"><small>Hello".strtoupper($row['name'])."</small><br> <br>Welcome to GraduateFreelancers</h1>";
$message .="<h2 style=\"text-align:center;font-weight:normal;font-family:Helvetica,Arial,sans-serif;font-size:23px;margin-bottom:10px;color:#205478;line-height:135%;\"><small>OUR JOB IS TO FIND YOU A JOB</small></h2>";
$message .="<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;\">GraduateFreelancers is India’s one of the growing online career and recruitment resource with its global essencia technology provides relevant profiles to employers and relevant jobs to job-seekers across industry verticals, experience levels and geographies. Best rated by people have registered on the site over largest Indian network.</div>";
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// CONTENT TABLE
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// FLEXIBLE CONTAINER
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// CENTERING TABLE
$message .="</td>";
$message.= "</tr>";
$message .="<tr mc:hideable>";
$message .="<td align=\"center\" valign=\"top\">";
// CENTERING TABLE
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
//FLEXIBLE CONTAINER
$message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .="<tr>";
$message .="<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
// CONTENT TABLE
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// FLEXIBLE CONTAINER
$message .="</td>";
$message .="</tr>";
$message .="</table>";
// CENTERING TABLE
$message.="</td>";
$message .="</tr>";
// MODULE ROW
// MODULE ROW //
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
//CENTERING TABLE //
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#F8F8F8\">";
$message.="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
// FLEXIBLE CONTAINER
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .="<tr>";
$message .="<td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">";
$message.="<tr>";
$message .="<td align=\"center\" valign=\"top\">";
// CONTENT TABLE
$message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .="<tr>";
$message .="<td valign=\"top\" class=\"textContent\">";
$message .="<h3 mc:edit=\"header\" style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;\">Thank You</h3>
<div mc:edit=\"body\" style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-left:-25%; margin-bottom:0;color:#5F5F5F;line-height:135%; width:150%;\">Let me take this opportunity to thank you for choosing GraduateFreelancers to provide you the finest opportunities and services. We are proud to welcome satisfied freelancers and look forward to many years of working together.<br><br>If you have any questions about our services, we invite you to get in touch with out customaer care available at <i><b>contact#graduatefreelancers.in</b></i>, and we will be happy to assist you 24/7.</div>
</td>
</tr>
</table>
// CONTENT TABLE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>";
// MODULE ROW -->
// <!-- MODULE ROW // -->
$message.="<tr>
<td align=\"center\" valign=\"top\">
<!-- CENTERING TABLE // -->
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr>
<td align=\"center\" valign=\"top\">
<!-- FLEXIBLE CONTAINER // -->
<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
<tr>
<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">
<!-- CONTENT TABLE // -->
<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr>
<td align=\"left\" valign=\"top\" class=\"flexibleContainerBox\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">
<tr>
<td align=\"left\" class=\"textContent\">
<h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:CENTER; width:130%;\">Complete your Profile</h3>
<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;\">We care about your career more than anyone else, which gives us an opportunity to let you know that a complete profile with uploaded CV gets noticed by Recruiters more than the othere who haven't.</div>
</td>
</tr>
</table>
</td>
<td align=\"right\" valign=\"middle\" class=\"flexibleContainerBox\">
<table class=\"flexibleContainerBoxNext\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">
<tr>
<td align=\"left\" class=\"textContent\">
<h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center; margin-right:-50%; width:180%;\">Upload a Profile picture</h3>
<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:155%; margin-right:-50%; width:180%;\">Recruiters get what they see. And now to help them get to know you better, we requerst you to take a bit effort to upload your profile picture.</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>";
// MODULE ROW -->
// MODULE ROW //
$message .="<tr>
<td align=\"center\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr style=\"padding-top:0;\">
<td align=\"center\" valign=\"top\">
<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
<tr>
<td style=\"padding-top:0;\" align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">
<!-- CONTENT TABLE // -->
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\" class=\"emailButton\" style=\"background-color: #3498DB;\">
<tr>
<td align=\"center\" valign=\"middle\" class=\"buttonContent\" style=\"padding-top:15px;padding-bottom:15px;padding-right:15px;padding-left:15px;\">
<a style=\"color:#FFFFFF;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:20px;line-height:135%;\" href=\"www.graduatefreelancers/freelancerssign/\" target=\"_blank\">LogIn Here</a>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>";
// MODULE ROW -->
// MODULE ROW // -->
// MODULE ROW // -->
$message .="<tr>
<td align=\"center\" valign=\"top\">
<!-- CENTERING TABLE // -->
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr>
<td align=\"center\" valign=\"top\">
<!-- FLEXIBLE CONTAINER // -->
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
<tr>
<td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">
<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">
<tr>
<td align=\"center\" valign=\"top\">
<!-- CONTENT TABLE // -->
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr>
<td valign=\"top\" class=\"textContent\">
<h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;\">Projects Related to your Streams</h3>
<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;margin-top:3px;color:#5F5F5F;line-height:135%;\">Now let us get to the business. Here are some paid projects recruiters have posted from past two weeks.</div>
</td>
</tr>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>";
mail($email, "Welcome", $message,$headers);
?>
And also I would suggest that you use PDO prepared statements. let me know if the code doesn't make sense to you.
You can use this for reference, refer the section "Sending HTML Email".
As of your question mail ('''what goes here is my question'''');
PHP mail function is formatted as
mail($to, $subject, $message, $headers);
Please check the PHP doc for mail function for more readings.
The code below works, but I want to change the months into names, such as "October", "November" and "December" using MONTHNAME. When I do, I get an error like the following:
JulyError in query: unknown column 'July' in 'where clause'.
What am I doing wrong?
<html>
<body>
<?php
$connection = mysql_connect('localhost','root','') or die ('unable to connect');
mysql_select_db("naurah")or die ("cannot select db");
$query = "SELECT YEAR(date) AS year, SUM(total) AS total FROM `order` GROUP BY year";
$result = mysql_query($query) or die ("Error in query:".mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row=mysql_fetch_array($result)) {
echo $row[0];
$query1 = "SELECT * FROM `order` WHERE YEAR(date) = $row[0]";
$result1=mysql_query($query1) or die ("Error in query:".mysql_error());
if (mysql_num_rows($result1) > 0) {
echo '<table border="1" cellpadding="0" cellspacing="0" class="tg">
<strong>
<tr>
<th class="tg-031e">Order ID</th>
<th class="tg-031e" width="100">Date</th>
<th class="tg-031e">Name</th>
<th class="tg-031e">Email</th>
<th class="tg-031e" width="100">Telephone</th>
<th class="tg-031e">Address</th>
<th class="tg-031e">City</th>
<th class="tg-031e">Postcode</th>
<th class="tg-031e">State</th>
<th class="tg-031e">Reference No</th>
<th class="tg-031e">Total</th>
<th class="tg-031e">Order Status</th>
<th class="tg-031e">Postage</th>
<th class="tg-031e">Action</th>
</tr>
</strong>';
while ($row1 = mysql_fetch_array($result1)) {
echo "
<tr>
<td class=\"tg-4eph\" ><div align=\"center\"> $row1[0] </div></td>
<td class=\"tg-031e\" ><div align=\"center\"> $row1[1] </div></td>
<td class=\"tg-031e\" ><div align=\"center\">$row1[3] $row1[2]</div></td>
<td class=\"tg-4eph\" ><div align=\"center\"> $row1[4]</div></td>
<td class=\"tg-031e\" ><div align=\"center\"> $row1[5]</div></td>
<td class=\"tg-4eph\" ><div align=\"center\"> $row1[6]</div></td>
<td class=\"tg-031e\" ><div align=\"center\"> $row1[7]</div></td>
<td class=\"tg-4eph\" ><div align=\"center\"> $row1[8]</div></td>
<td class=\"tg-031e\"><div align=\"center\"> $row1[9]</div></td>
<td class=\"tg-031e\"><div align=\"center\"> $row1[10]</div></td>
<td class=\"tg-031e\"><div align=\"center\"> $row1[11]</div></td>
<td class=\"tg-031e\"><div align=\"center\"> $row1[12]</div></td>
<td class=\"tg-031e\"><div align=\"center\"> $row1[13]</div></td>
<td class=\"tg-4eph\" width=\"100\"><div align=\"center\">
<a href=\"adminupdatetrans.php?orderID= $row1[0]\">
<img src=\"../images/icn_edit_article.png\" title=\"Remove\"/>
</a>
<a href=\"admindeleteorder.php?orderID= $row1[0] \" onclick=\"return confirm('Are you sure want to delete ?')\">
<img src=\"../images/icn_trash.png\" title=\"Remove\"/>
</a>
</td>
</tr>
";
}
echo '
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td >Total All:</td>
';
echo '<td>RM';
echo $row[1];
echo '</td></tr>';
echo '</table>';
}
}
}
?>
</body>
</html>
Assuming that the date is in a timestamp format :),
You can get the names of months thanks to this method :
date("F",mktime(0,0,0,date('m', $timestamp),1,2011));Or like this :
date('F', strtotime("2015-date('m', $timestamp)-01"));
Got 2 questions regarding a table which output is below:
Question 1:
The table height is 500px, yet what I don't understand is that it looks like the content underneath which doesn't belong to the table is displayed within the table because of the scroll bar that goes so that down that it looks like the content underneath the table rows are in the table. So my question is how can I get the scroll bar to appear only if the 500px is met, rather than showing it straight away as it is doing now? How do I get the content (select box, heading, etc) be displayed underneath the table rather than in the table as it is doing in the screenshot
Question 2:
How can I get the scroll bar to be clipped on the side of the table? At the moment it is clipped just underneath the last column meaning it is taking up some of the last column's space and hence why table columns are not matching.
Below is html code of table:
<table id="tableqanda" align="center" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th width="30%" class="question">Question</th>
<th width="8%" class="option">Option Type</th>
<th width="6%" class="noofanswers">Number of Answers</th>
<th width="8%" class="answer">Answer</th>
<th width="6%" class="noofreplies">Number of Replies</th>
<th width="6%" class="noofmarks">Number of Marks</th>
<th width="12%" class="images">Images</th>
</tr>
</thead>
</table>
<div id="tableqanda_onthefly_container">
<table id="tableqanda_onthefly" align="center" cellpadding="0" cellspacing="0">
<tbody>
<?php
foreach ($arrQuestionContent as $key=>$question) {
echo '<tr class="tableqandarow">'.PHP_EOL;
echo '<td width="30%" class="question">'.htmlspecialchars($question).'</td>' . PHP_EOL;
echo '<td width="8%" class="option">'.htmlspecialchars($arrOptionType[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofanswers">'.htmlspecialchars($arrNoofAnswers[$key]).'</td>' . PHP_EOL;
echo '<td width="8%" class="answers">'.htmlspecialchars($arrAnswer[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofreplies">'.htmlspecialchars($arrReplyType[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofmarks">'.htmlspecialchars($arrQuestionMarks[$key]).'</td>' . PHP_EOL;
echo '<td width="12%" class="images">'.htmlspecialchars($arrImageFile[$key]).'</td>' . PHP_EOL;
echo '</tr>'.PHP_EOL;
}
?>
</tbody>
</table>
<h4>PARTICIPATING STUDENTS</h4>
<p>
<strong>Number of Participating Students:</strong> <?php echo $studentnum; ?>
</p>
<p>
<strong>Current Participating Students:</strong>
<br/>
<tr>
<td>
<select name="students" id="studentslist" size="10">
<?php
if($studentnum == 0){
echo "<option disabled='disabled' class='red' value=''>No Students currently in this Assessment</option>";
}else{
while ( $currentstudentstmt->fetch() ) {
echo "<option disabled='disabled' value='$dbStudentId'>" . $dbStudentAlias . " - " . $dbStudentForename . " " . $dbStudentSurname . "</option>" . PHP_EOL;
}
}
?>
</select>
</p>
Below is CSS:
#tableqanda_onthefly_container
{
width:100%;
overflow-y: scroll;
overflow-x: hidden;
max-height:500px;
}
#tableqanda_onthefly
{
width:100%;
overflow:auto;
clear:both;
}
#tableqanda, #tableqanda_onthefly{
border:1px black solid;
border-collapse:collapse;
table-layout:fixed;
}
#tableqanda{
width:100%;
margin-left:0;
float:left;
}
#tableqanda td {
vertical-align: middle;
border:1px black solid;
border-collapse:collapse;
}
#tableqanda th{
border:1px black solid;
border-collapse:collapse;
text-align:center;
}
I want my table to remain as a scrolling table with fixed headers
UPDATE
For question 1, try setting the overflow-y property to auto. This way the scrollbar will only be displayed once the table exceeds 500px in height.
So something like:
overflow-y:auto;
instead of
overflow-y:scroll;
ORIGINAL POST:
To answer your second question, you can just add the heads of the table as another row:
<div id="tableqanda_onthefly_container">
<table id="tableqanda_onthefly" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="30%" class="question">Question</th>
<th width="8%" class="option">Option Type</th>
<th width="6%" class="noofanswers">Number of Answers</th>
<th width="8%" class="answer">Answer</th>
<th width="6%" class="noofreplies">Number of Replies</th>
<th width="6%" class="noofmarks">Number of Marks</th>
<th width="12%" class="images">Images</th>
</tr>
<?php
foreach ($arrQuestionContent as $key=>$question) {
echo '<tr class="tableqandarow">'.PHP_EOL;
echo '<td width="30%" class="question">'.htmlspecialchars($question).'</td>' . PHP_EOL;
echo '<td width="8%" class="option">'.htmlspecialchars($arrOptionType[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofanswers">'.htmlspecialchars($arrNoofAnswers[$key]).'</td>' . PHP_EOL;
echo '<td width="8%" class="answers">'.htmlspecialchars($arrAnswer[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofreplies">'.htmlspecialchars($arrReplyType[$key]).'</td>' . PHP_EOL;
echo '<td width="6%" class="noofmarks">'.htmlspecialchars($arrQuestionMarks[$key]).'</td>' . PHP_EOL;
echo '<td width="12%" class="images">'.htmlspecialchars($arrImageFile[$key]).'</td>' . PHP_EOL;
echo '</tr>'.PHP_EOL;
}
?>
</table>
</div>
This way the scroll bar should be put at the very right, not underneath anything. The reason it wasn't before was because you had two different tables with independent widths.
Old ASP developer migrating to PHP. I writ a PHP script to retrieve entries from an MS SQL Database and display. Looks like this:
<?php
$query = "SELECT DateUploaded, Title ";
$query .= "FROM TableName ";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["DateUploaded"] . $row["Title"] . "</li>";
}
?>
Now when I want to get it to display echoing it just on the page works fine. Using this section of code:
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["DateUploaded"] . $row["Title"] . "</li>";
}
However when I try and put it into a table Ive created to display it it doesn't seem to work, although I've read a few tutorials and feel it should, it is also similar to a technique I used to use in ASP.
Looks like this:
<TABLE cellSpacing=1 cellPadding=2 align=center bgColor=#aaaaaa border=0 width="100%" class="logintbl">
<TR>
<TD bgColor=whitesmoke colSpan=0><B>News</B></td>
</tr>
<tr>
<td bgColor=#ffffff>
<table align="center" cellSpacing=0 cellPadding=2 border="0" width="100%">
<tr>
<td align="center" valign="bottom"> <font color="#4d71a1"><b>Date Uploaded</b></font> </td>
<td align="center" valign="bottom"> <font color="#4d71a1"><b>News Title</b></font> </td>
<td align="center"></td>
</tr>
<tr bgcolor="#eeeeee">
<tr bgcolor="#ffffff">
<td align="center"><?php echo $row["DateUploaded"]; ?></td>
<td align="center"><?php echo $row["Title"]; ?></td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<a href="NewsManage.php?do=del&id=" return false;">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</a>
</td>
</tr>
<tr><td colspan="7"> </td></tr>
<tr>
<td colspan="7" align="center">
</td>
</tr>
</table>
</td>
</tr>
</table>
I'm probably doing it totally wrong, but could someone point me in the right direction please?
Put the row into echo inside your loop:
<?php
while($row = mssql_fetch_array($result))
{
echo '<tr bgcolor="#ffffff">
<td align="center">'.$row["DateUploaded"].'</td>
<td align="center">'.$row["Title"].'</td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</td>
</tr>';
}
?>
Start the while loop right before the row with the data,
and end it right after that.
<table align="center" cellSpacing=0 cellPadding=2 border="0" width="100%">
<!-- header row here -->
<?php
$alterColor = true;
while ($row = mssql_fetch_array($result)) { // start while
// alternating bg color for rows
$color = ($alterColor) ? "#fff" : "#eee";
$alterColor = !$alterColor;
?>
<tr bgcolor="<?php echo $color; ?>">
<td align="center"><?php echo $row["DateUploaded"]; ?></td>
<td align="center"><?php echo $row["Title"]; ?></td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<a href="NewsManage.php?do=del&id=" return false;">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</a>
</td>
</tr>
<?php } // end while ?>
</table>
PS One of these seems to be extra, are they there for alternating color or something like that:
<tr bgcolor="#eeeeee">
<tr bgcolor="#ffffff">
You should not really have a tr within a tr directly.
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/