enfuego
12-26-2006, 10:52 AM
Hey all. Could use some help. I am in the process of converting front-page to php. Need to send email upon submission. How does this look? Any suggestions/Help would be greatly appreciated.
php file:
<?
require_once("Mail.php");
function emailmsg($S-Email-Address, $Notification, $Location_Type, $Notification_Type,
$Date_Outage_Tripped, $Time_Outage_Tripped, $Date_Outage_Cleared, $Time_Outage_Cleared,
$Fix_Code, $Pool, $Node, $Location, $Impacted, $Notes, $Dispatcher) {
$recipients = $S-Email-Address;
$headers["To"] = $S-Email-Address;
$headers["Subject"] = $Notification;
$headers["Content-Type"] = "text/plain";
$params["host"] = "mail-relay.company.com";
$params["port"] = "32";
$mail_object =& Mail::factory("smtp", $params);
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$mail_object->send($S-Email-Address, $Notification, $Location, $Notification_Type,
$Date_Tripped, $Time_Tripped, $Date_Cleared, $Time_Cleared,
$Fix_Code, $Pool, $Node, $Location, $Impacted, $Notes, $Dispatcher);
}
?>
Html code:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Email Tool</title>
</head>
<body bgcolor="#C0C0C0">
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
var radioSelected = false;
for (i = 0; i < theForm.Notification_Type.length; i++)
{
if (theForm.Location_Type[i].checked)
radioSelected = true;
}
if (!radioSelected)
{
alert("Please select one of the \"Location_Type\" options.");
return (false);
}
for (i = 0; i < theForm.Notification_Type.length; i++)
{
if (theForm.Notification_Type[i].checked)
radioSelected = true;
}
if (!radioSelected)
{
alert("Please select one of the \"Notification_Type\" options.");
return (false);
}
if (theForm.Dispatcher.value == "")
{
alert("Please enter a value for the \"Dispatcher\" field.");
theForm.Dispatcher.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" name="FrontPage_Form1" action=blablalba.htm" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" webbot-action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" S-Email-Format="HTML/UL" S-Email-Address="email@email.com" B-Email-Label-Fields="TRUE" B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Do Not Relpy" B-Email-Subject-From-Field="FALSE" S-Email-Subject="Outage Notification" S-Builtin-Fields startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan --><p align="center" style="margin-top: 0; margin-bottom: 0">
<b><font color="#0000FF">Outage Notification</font></b></p>
<div align="center"><output type="text" name="Outage_Notification" value="Outage Notification">
<table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="38%" id="AutoNumber1" height="105">
<tr>
<td width="100%" height="7" align="center" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Location</b></td>
</tr>
<tr>
<td width="38%" height="1" align="center">Akron<b><!--webbot bot="Validation" b-value-required="TRUE" --><input type="radio" value="Akron" name="Location_Type"></b></td>
<td width="26%" height="1">Canton<b><input type="radio" name="Location_Type" value="Canton"></b></td>
<td width="38%" height="1">Kent<b><input type="radio" name="Location_Type" value="Kent"></b></td>
</tr>
<tr>
<td width="100%" height="7" align="center" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Notification Type</b></td>
</tr>
<tr>
<td width="50%" height="1" align="right">Tripping <b><!--webbot bot="Validation" b-value-required="TRUE" --><input type="radio" value="Tripping Outage" name="Notification_Type"></b></td>
<td width="50%" height="1">
Clearing Outage<b><input type="radio" name="Notification_Type" value="Clearing "></b></td>
</tr>
<tr>
<td width="100%" height="1" align="right" colspan="2">
<hr color="#000000" size="1"></td>
</tr>
<tr>
<td width="50%" height="10" align="right"><b>Date Tripped</b></td>
<td width="50%" height="10">
<input type="text" name="Date_Tripped" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Time Tripped</b></td>
<td width="50%" height="22">
<input type="text" name="Time_Tripped" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Date Cleared</b></td>
<td width="50%" height="22">
<input type="text" name="Date_Cleared" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="8" align="right"><b>Time Cleared</b></td>
<td width="50%" height="8">
<input type="text" name="Time_Cleared" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="7" align="right"><b>Fix Code</b></td>
<td width="50%" height="7">
<input type="text" name="Fix_Code" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Pool</b></td>
<td width="50%" height="22">
<input type="text" name="Pool" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Node</b></td>
<td width="50%" height="20">
<input type="text" name="Node" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Location (City, Street)</b></td>
<td width="50%" height="20">
<input type="text" name="Location" size="23" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Impacted</b></td>
<td width="50%" height="20">
<input type="text" name="Impacted" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="100%" height="75" align="right" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Notes</b></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<textarea rows="5" name="Notes" cols="41" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></textarea></td>
</tr>
<tr>
<td width="49%" height="21" align="right">
<b>Dispatcher</b></td>
<td width="51%" height="21" align="right">
<!--webbot bot="Validation" b-value-required="TRUE" --><input name="Dispatcher" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; float:left"></td>
</tr>
<tr>
<td width="100%" height="6" align="right" colspan="2">
<p align="center">
<input type="submit" value="Submit"></p>
</td>
</tr>
</table>
</center>
</div>
<?php
echo($S-Email-Address);
echo($Notification);
echo($Location_Type);
echo($Notification_Type);
echo($Date_Tripped);
echo($Time_Tripped);
echo($Date_Cleared);
echo($Time_Cleared);
echo($Fix_Code);
echo($Pool);
echo($Node);
echo($Location);
echo($Impacted);
echo($Notes);
echo($Dispatcher);
?>
</form>
</body>
</html>
php file:
<?
require_once("Mail.php");
function emailmsg($S-Email-Address, $Notification, $Location_Type, $Notification_Type,
$Date_Outage_Tripped, $Time_Outage_Tripped, $Date_Outage_Cleared, $Time_Outage_Cleared,
$Fix_Code, $Pool, $Node, $Location, $Impacted, $Notes, $Dispatcher) {
$recipients = $S-Email-Address;
$headers["To"] = $S-Email-Address;
$headers["Subject"] = $Notification;
$headers["Content-Type"] = "text/plain";
$params["host"] = "mail-relay.company.com";
$params["port"] = "32";
$mail_object =& Mail::factory("smtp", $params);
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$mail_object->send($S-Email-Address, $Notification, $Location, $Notification_Type,
$Date_Tripped, $Time_Tripped, $Date_Cleared, $Time_Cleared,
$Fix_Code, $Pool, $Node, $Location, $Impacted, $Notes, $Dispatcher);
}
?>
Html code:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Email Tool</title>
</head>
<body bgcolor="#C0C0C0">
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
var radioSelected = false;
for (i = 0; i < theForm.Notification_Type.length; i++)
{
if (theForm.Location_Type[i].checked)
radioSelected = true;
}
if (!radioSelected)
{
alert("Please select one of the \"Location_Type\" options.");
return (false);
}
for (i = 0; i < theForm.Notification_Type.length; i++)
{
if (theForm.Notification_Type[i].checked)
radioSelected = true;
}
if (!radioSelected)
{
alert("Please select one of the \"Notification_Type\" options.");
return (false);
}
if (theForm.Dispatcher.value == "")
{
alert("Please enter a value for the \"Dispatcher\" field.");
theForm.Dispatcher.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" name="FrontPage_Form1" action=blablalba.htm" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" webbot-action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" S-Email-Format="HTML/UL" S-Email-Address="email@email.com" B-Email-Label-Fields="TRUE" B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Do Not Relpy" B-Email-Subject-From-Field="FALSE" S-Email-Subject="Outage Notification" S-Builtin-Fields startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan --><p align="center" style="margin-top: 0; margin-bottom: 0">
<b><font color="#0000FF">Outage Notification</font></b></p>
<div align="center"><output type="text" name="Outage_Notification" value="Outage Notification">
<table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="38%" id="AutoNumber1" height="105">
<tr>
<td width="100%" height="7" align="center" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Location</b></td>
</tr>
<tr>
<td width="38%" height="1" align="center">Akron<b><!--webbot bot="Validation" b-value-required="TRUE" --><input type="radio" value="Akron" name="Location_Type"></b></td>
<td width="26%" height="1">Canton<b><input type="radio" name="Location_Type" value="Canton"></b></td>
<td width="38%" height="1">Kent<b><input type="radio" name="Location_Type" value="Kent"></b></td>
</tr>
<tr>
<td width="100%" height="7" align="center" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Notification Type</b></td>
</tr>
<tr>
<td width="50%" height="1" align="right">Tripping <b><!--webbot bot="Validation" b-value-required="TRUE" --><input type="radio" value="Tripping Outage" name="Notification_Type"></b></td>
<td width="50%" height="1">
Clearing Outage<b><input type="radio" name="Notification_Type" value="Clearing "></b></td>
</tr>
<tr>
<td width="100%" height="1" align="right" colspan="2">
<hr color="#000000" size="1"></td>
</tr>
<tr>
<td width="50%" height="10" align="right"><b>Date Tripped</b></td>
<td width="50%" height="10">
<input type="text" name="Date_Tripped" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Time Tripped</b></td>
<td width="50%" height="22">
<input type="text" name="Time_Tripped" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Date Cleared</b></td>
<td width="50%" height="22">
<input type="text" name="Date_Cleared" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="8" align="right"><b>Time Cleared</b></td>
<td width="50%" height="8">
<input type="text" name="Time_Cleared" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="7" align="right"><b>Fix Code</b></td>
<td width="50%" height="7">
<input type="text" name="Fix_Code" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="22" align="right"><b>Pool</b></td>
<td width="50%" height="22">
<input type="text" name="Pool" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Node</b></td>
<td width="50%" height="20">
<input type="text" name="Node" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Location (City, Street)</b></td>
<td width="50%" height="20">
<input type="text" name="Location" size="23" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="50%" height="20" align="right"><b>Impacted</b></td>
<td width="50%" height="20">
<input type="text" name="Impacted" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
</tr>
<tr>
<td width="100%" height="75" align="right" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0"><b>Notes</b></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<textarea rows="5" name="Notes" cols="41" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></textarea></td>
</tr>
<tr>
<td width="49%" height="21" align="right">
<b>Dispatcher</b></td>
<td width="51%" height="21" align="right">
<!--webbot bot="Validation" b-value-required="TRUE" --><input name="Dispatcher" size="9" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; float:left"></td>
</tr>
<tr>
<td width="100%" height="6" align="right" colspan="2">
<p align="center">
<input type="submit" value="Submit"></p>
</td>
</tr>
</table>
</center>
</div>
<?php
echo($S-Email-Address);
echo($Notification);
echo($Location_Type);
echo($Notification_Type);
echo($Date_Tripped);
echo($Time_Tripped);
echo($Date_Cleared);
echo($Time_Cleared);
echo($Fix_Code);
echo($Pool);
echo($Node);
echo($Location);
echo($Impacted);
echo($Notes);
echo($Dispatcher);
?>
</form>
</body>
</html>