Okay so heres the dillio deal-
I need to send the following code in an email...but its a mix of php and html, and it retrieves various values from a database before sending...oh and i wouldnt mind the sending of the mail to be done on a button click!...anyways i have messed and messed but i aint too sure whether it can be done! Can someone please tell me the code and where i need to place it within my code? :queasy:
i'll post it all for whoever wants to take a look!
Thank you in advance
Ps...I know my code is off the wall, i'm like this when i java program too!!:rolleyes:
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<TITLE>Network Operation Centre Morning Bulletin- Preview Bulletin</TITLE>
<img align="left" align="top" src="TMDicon.JPG" alt="Icon" width="189" height="39">
<H2>Trader Media Digital Network Operation Centre Morning Bulletin</H2>
<body>
</br>
<?php
$connect= mysql_connect('localhost',','');
if (!$connect) { echo("ERROR: Not connecting" . mysql_error() . "\n"); }
mysql_select_db('sophie');
?>
<p align="center"><?php
$day = date('l, ');
$dtoday = date('Y-m-d');
$time = date('H:i:sa');
$timez = date('O T');
print "Date: $day $dtoday Time: $time. Time zone: $timez"; ?>
</p>
<h2><b>Trader Media Digital - Service Issues:</b></h2>
<big><b> Current Service Issues: </b></big><br/>
<b> Incidents: </b>
The following services are unavailable or otherwise affected, as of 10:00 this morning:<br/><br/>
<?php
$result = mysql_query("SELECT * FROM bulletin_data WHERE `RepDate` = '$dtoday'");
echo "<table border='1' cellspacing='0' cellpadding='0'>
<tr>
<th><b><font color='darkblue'>Country</font></b></th>
<th><b><font color='darkblue'>Service</font></b></th>
<th><b><font color='darkblue'>Status Description</font></b></th>
<th><b><font color='darkblue'>RefNo</font></b></th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td><font color='darkblue'>" . $row['Country'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['Service'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['StatusDesc'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['RefNo'] . "</font></td>";
echo "</tr>";
}
echo "</table>";
echo "</table>";
echo "</br>";
echo "<big><b>Historic service issues:</b></big></br>";
echo "Listed below are significant incidents encountered in the last 24 hrs that have been resolved:<br/><br/>";
$results = mysql_query("SELECT * FROM bulletin_data WHERE `RepDate` = '$dtoday'");
echo "<table border='1' cellspacing='0' cellpadding='0'>
<tr>
<th><b><font color='darkblue'>Country</font></b></th>
<th><b><font color='darkblue'>Service</font></b></th>
<th><b><font color='darkblue'>Summary</font></b></th>
<th><b><font color='darkblue'>Impact</font></b></th>
<th><b><font color='darkblue'>Time Period</font></b></th>
<th><b><font color='darkblue'>PastRefNo</font></b></th>
</tr>";
while($row = mysql_fetch_array($results))
{
echo "<tr>";
echo "<td><font color='darkblue'>" . $row['PastCountry'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['PastService'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['IssueSummary'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['IssueImpact'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['TimePeriod'] . "</font></td>";
echo "<td><font color='darkblue'>" . $row['PastRefNo'] . "</font></td>";
echo "</tr>";
}
echo "</table>";
echo "</br><br/>";
echo "<h2><b>Trader Media Digital - NOC News:</b></h2>";
echo "<b><big>Deployments and Maintenance News for Today:</big></b><br/>";
echo "<br/><b><font color='red'>Service Affecting Deployments and Maintenance</font></b>";
$todayd = date('Y-m-d');
$resul = mysql_query("SELECT * FROM `bulletin_data` WHERE `RepDate` = '$todayd' AND `ServiceAffect` !=('NULL')");
echo "<table border='0'>";
while($row = mysql_fetch_array($resul))
{
echo "<tr>";
echo "<td><font color='red'>". $row['ServiceAffect']."</font></td>";
echo "</tr>";
}
echo "</table>";
echo "<br/><b><font color='darkblue'>Non-Service Affecting Deployments and Maintenance</font></b>";
$todaydy = date('Y-m-d');
$res = mysql_query("SELECT * FROM bulletin_data WHERE `RepDate` = '$todaydy' AND `NonServiceAffect` !=('NULL')");
echo "<table border='0'>";
while($row = mysql_fetch_array($res))
{
echo "<tr>";
echo "<td><font color='darkblue'>". $row['NonServiceAffect']."</font></td>";
echo "</tr>";
}
echo "</table>";
echo "<br/><br/><b><big>Deployments and Maintenance News for Tomorrow:</big></b><br/>";
echo "<br/><b><font color='red'>Service Affecting Deployments and Maintenance</font></b>";
$dytoday = date('Y-m-d');
$reslt = mysql_query("SELECT * FROM bulletin_data WHERE `RepDate` = '$dytoday' AND `ServAffectTomrw` !=('NULL')");
echo "<table border='0'>";
while($row = mysql_fetch_array($reslt))
{
echo "<tr>";
echo "<td><font color='red'>". $row['ServAffectTomrw']."</font></td>";
echo "</tr>";
}
echo "</table>";
echo "<br/><b><font color='darkblue'>Non-Service Affecting Deployments and Maintenance</b></font>";
$todayday = date('Y-m-d');
$resu = mysql_query("SELECT * FROM bulletin_data WHERE `RepDate` = '$todayday' AND `NonServAffectTomrw` !=('NULL')");
echo "<table border='0'>";
while($row = mysql_fetch_array($resu))
{
echo "<tr>";
echo "<td><font color='darkblue'>". $row['NonServAffectTomrw']."</font></td>";
echo "</tr>";
}
echo "</table>";
echo "<p align='center'>Click 'Return' to go back and enter more data or click 'Send' to send the NOC Bulletin via e-mail.</p>";
echo "<p align='center'><input type='button' value='Return' onClick=\"window.location='http://nlwapp103/nocapps/sophie/'\">";
echo "<p align='center'><input type='button' value='Send' onClick='\"window.location='http://nlwapp103/nocapps/sophie/'\">";
msql_close($connection);
?>
</body>
</html>