Ok, You can probably see what I'm trying to do here, but for some reason I REALLY can't get it to work right.
First, it only sends SOME TIMES, but won't give an error. Second, it'll give me an error on the "Priotity" area of the code but I'm not sending a priority order. Only a "routine" order.
Ugh, this is really bugging me!!!
<HTML>
<HEAD>
<TITLE>MXWIS Order Form - Submit</TITLE>
</HEAD>
<BODY BGCOLOR="#00004a">
<CENTER>
<TABLE WIDTH="100%" BGCOLOR="#00004a" CELLSPACING=0 CELLPADDING=0 VALIGN=CENTER BORDER=0>
<TR>
<TD>
<CENTER>
<?
require("db_connect.php");
$fontstring = "<font face='arial' size='1' color='#cccccc'>";
$site_email = "5muns.mxwis@minot.af.mil";
$email = "$first_name.$last_name@minot.af.mil";
$today = date('M d, Y',strtotime($today));
if($request == "Routine")
{
$priority = "05";
}
else
{
$priority = "03";
}
//What's sent to the customer on the page
if ($first_name == "" || $last_name == "" || $Phone_Number == "" || $Your_Shop == "Select Shop" || $Account == "Pick account" || $Quanity == "" || $Nomenclature == "" || $NSN == "")
{
echo ("$fontstring Not Transmitted</td></tr></table>
<br><font color=red> Error:</font> $fontstring Fields not filled out correctly! Click back to try again.
<br><br>$fontstring REQUIRED FIELDS:<br><br>
$fontstring First and Last Name<br>
$fontstring Phone Number<br>
$fontstring Your Shop<br>
$fontstring Account Number<br>
$fontstring NSN<br>
$fontstring Quantity<br>
$fontstring Nomenclature<br>
");
}
/*
else
{
*/
if($request == "Priority" && $TO_FIG_INDEX == "" || $JCN == "" || $SRD == "" || $WUC == "" || $Justification == "" || $auth == ""){
/* if ($TO_FIG_INDEX == "" || $JCN == "" || $SRD == "" || $WUC == "" || $Justification == "" || $auth == "")
{
*/
echo("
$fontstring Not Transmitted</td></tr></table>
<br><font color=red> Error:</font> $fontstring Fields not filled out correctly! Click back to try again.
<br><br>$fontstring REQUIRED FIELDS FOR MICAP ORDERS:<br><br>
$fontstring JCN<br>
$fontstring SRD<br>
$fontstring WUC<br>
$fontstring Justification<br>
$fontstring Authorization<br>
");
}
/* else
{
$email = "$first_name.$last_name@minot.af.mil";
sendmail($email, $site_email, $fontstring, $Rank, $last_name, $first_name, $Phone_Number, $Your_Shop, $Account, $JCN, $DIFM, $Part_Number, $NSN, $Unit_of_Issue, $Quanity, $Nomenclature, $cage_code, $TO_FIG_INDEX, $SRD, $WUC, $Justification, $auth, $request, $extra);
}
}*/
else{
sendmail($email, $site_email, $fontstring, $Rank, $last_name, $first_name, $Phone_Number, $Your_Shop, $Account, $JCN, $DIFM, $Part_Number, $NSN, $Unit_of_Issue, $Quanity, $Nomenclature, $cage_code, $TO_FIG_INDEX, $SRD, $WUC, $Justification, $auth, $request, $extra);
}
function sendmail($email, $site_email, $fontstring, $Rank, $last_name, $first_name, $Phone_Number, $Your_Shop, $Account, $JCN, $DIFM, $Part_Number, $NSN, $Unit_of_Issue, $Quanity, $Nomenclature, $cage_code, $TO_FIG_INDEX, $SRD, $WUC, $Justification, $auth, $request, $extra)
{
$sql = "INSERT INTO orders SET name = \"$Rank $last_name\", shop = \"$Your_Shop\", nomenclature = \"$Nomenclature\", nsn = '$NSN', part_num = '$Part_Number', quantity = '$Quanity', date = \"$today\", rec = '0'";
@mysql_query($sql) or die ("<p>$fontstring $sql<P>".mysql_errno().": ".mysql_error());
//secure stuff...
echo("
$fontstring<BR><CENTER>
Thank you $Rank $last_name for your order.
<table border='0' cellpadding='0' cellspacing='0' width='50%'>
<tr>
<td bgcolor='#666666' colspan='2' height='29'> $fontstring You Submitted
following information:</td>
</tr>
<tr>
<td width='39%'>$fontstring Name: </td>
<td width='61%'>$fontstring $Rank $last_name </td>
</tr>
<tr>
<td width='39%'>$fontstring Phone Number:</td>
<td width='61%'>$fontstring $Phone_Number</td>
</tr>
<tr>
<td width='39%'>$fontstring Your Shop: </td>
<td width='61%'>$fontstring $Your_Shop</td>
</tr>
<tr>
<td width='39%'>$fontstring Account: </td>
<td width='61%'>$fontstring $Account</td>
</tr>
<tr>
<td width='39%'>$fontstring JCN: </td>
<td width='61%'>$fontstring $JCN</td>
</tr>
<tr>
<td bgcolor='#666666' colspan='2' height='26'> $fontstring You ordered the
following item(s):</td>
</tr>
<tr>
<td width='39%'>$fontstring Part Number: </td>
<td width='61%'>$fontstring $Part_Number</td>
</tr>
<tr>
<td width='39%'>$fontstring NSN: </td>
<td width='61%'>$fontstring $NSN</td>
</tr>
<tr>
<td width='39%'>$fontstring Unit of Issue: </td>
<td width='61%'>$fontstring $Unit_of_Issue</td>
</tr>
<tr>
<td width='39%'>$fontstring Quanity: </td>
<td width='61%'>$fontstring $Quanity</td>
</tr>
<tr>
<td width='39%'>$fontstring Nomenclature: </td>
<td width='61%'>$fontstring $Nomenclature</td>
</tr>
<tr>
<td width='39%'>$fontstring Cage Code: </td>
<td width='61%'>$fontstring $cage_code</td>
</tr>
<tr>
<td bgcolor='#666666' colspan='2' height='26'> $fontstring You used the
following reference for your order:</td>
</tr>
<tr>
<td width='39%'>$fontstring TO, Figure, and Index: </td>
<td width='61%'>$fontstring $TO_FIG_INDEX</td>
</tr>
<tr>
<td width='39%'>$fontstring SRD: </td>
<td width='61%'>$fontstring $SRD</td>
</tr>
<tr>
<td>$fontstring WUC: </td>
<td>$fontstring $WUC</td>
</tr>
<tr>
<td>$fontstring Additional Info: </td>
<td>$fontstring $extra</td>
</tr>
<tr>
<td height='54' colspan='2'><div align='center'>
<p>$fontstring A copy of your order has been sent to $email. Please
retain that copy as your record.</p>
</div></td>
</tr>
<tr>
<td width='39%' height='29'></td>
<td width='61%'></td>
</tr>
</table><br><br><br>
$fontstring<META HTTP-EQUIV=\"Refresh\" CONTENT=\"7; URL=https://wwwmil.minot.af.mil/5muns/supportweb/index.htm\">
Please site tight while I forward you back to the Support Section Home Page.
</center>
");
mail("$site_email", "Order Form for $Your_Shop",
"
SUPPLY ORDER FORM
SHOP: $Your_Shop
INDIVIDUAL: $Rank $first_name $last_name
DATE: $today
PHONE: $Phone_Number
NOMENCLATURE: $Nomenclature
PART NUMBER: $Part_Number
STOCK NUMBER: $NSN
UNIT OF ISSUE: $Unit_of_Issue
QUANTITY: $Quanity
ACCOUNT: $Account
TECHNICAL ORDER: $TO_FIG_INDEX
PRIORITY: $priority
MICAP JUSTIFICATION: $Justification
MICAP AUTHORIZED BY: $auth
JCN: $JCN
WORK UNIT CODE: $WUC
SRD: $SRD
____________________________________________________________",
"From: $email\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
//This gets sent to the person who ordered with part
mail("$email", "Your Order Form",
"
Type of Order: $request
____________________________________________________________
Your information:
____________________________________________________________
Name: $Rank $last_name
Phone Number: $Phone_Number
Your Shop: $Your_Shop
Account: $Account
JCN: $JCN
What you ordered:
____________________________________________________________
Part Number: $Part_Number
NSN: $NSN
Unit of Issue: $Unit_of_Issue
Quanity: $Quanity
Nomenclature: $Nomenclature
Other information:
____________________________________________________________
TO, Figure, and Index: $TO_FIG_INDEX
SRD: $SRD
WUC: $WUC
DIFM $DIFM
Justification: $Justification
____________________________________________________________",
"From: $site_email\r\nReply-To: $site_email\r\nX-Mailer: DT_formmail");
}
?>
</center>
</BODY>
</HTML>