0
所以我有一個有趣的問題。我們設置這個PHP腳本來發送電子郵件,問題是Branch == 0根本不會發送的第一組電子郵件。所選擇的其他分支將發送電子郵件。我開始懷疑它是否與數量問題,「0」(我可能是錯的,一個)梅勒工作不正常
下面的代碼:
<?php
if(!$_POST){echo "Please go back"; exit();}
echo "<form action=\"confirm2.php\" METHOD=\"POST\">";
foreach ($_POST as $key => $value) {
// echo $key.": ".$value. "<br> ";
echo "<input type=\"hidden\" name=\"$key\" value=\"$value\">";
}
$message = '';
$DelMonth = $_POST['DelMonth'];
$DelDay = $_POST['DelDay'];
$DelYear = $_POST['DelYear'];
$Teller_Id = $_POST['Teller_Id'];
$First = $_POST['First'];
$Branch = $_POST['Branch'];
$Deposit_Ticket_Currency = $_POST['deposit_tickets_currency'];
$Deposit_Ticket_Coin = $_POST['deposit_tickets_coin'];
$Last = $_POST['Last'];
$FIT100 = $_POST['FIT100'];
$FIT50 = $_POST['FIT50'];
$FIT20 = $_POST['FIT20'];
$FIT10 = $_POST['FIT10'];
$FIT5 = $_POST['FIT5'];
$FIT2 = $_POST['FIT2'];
$FIT1 = $_POST['FIT1'];
$FITTOT=number_format($FIT100+$FIT50+$FIT20+$FIT10+$FIT5+$FIT2+$FIT1,0);
$New_Currency100 = $_POST['New_Currency100'];
$New_Currency50 = $_POST['New_Currency50'];
$New_Currency20 = $_POST['New_Currency20'];
$New_Currency10 = $_POST['New_Currency10'];
$New_Currency5 = $_POST['New_Currency5'];
$New_Currency2 = $_POST['New_Currency2'];
$New_Currency1 = $_POST['New_Currency1'];
$New_CurrencyTOT=number_format($New_Currency100+$New_Currency50+$New_Currency20+$New_Currency10+$New_Currency5+$New_Currency2+$New_Currency1,0);
$Rolled_CoinSusanb = $_POST['Rolled_CoinSusanb'];
$Rolled_CoinDollar = $_POST['Rolled_CoinDollar'];
$Rolled_CoinFifty = $_POST['Rolled_CoinFifty'];
$Rolled_CoinQuarter = $_POST['Rolled_CoinQuarter'];
$Rolled_CoinDimes = $_POST['Rolled_CoinDimes'];
$Rolled_CoinNickels = $_POST['Rolled_CoinNickels'];
$Rolled_CoinPennies = $_POST['Rolled_CoinPennies'];
$Rolled_CoinTOT=number_format($Rolled_CoinSusanb+$Rolled_CoinDollar+$Rolled_CoinFifty+$Rolled_CoinQuarter+$Rolled_CoinDimes+$Rolled_CoinNickels+$Rolled_CoinPennies,2);
$Grand_Tot=number_format($FIT100+$FIT50+$FIT20+$FIT10+$FIT5+$FIT2+$FIT1+$New_Currency100+$New_Currency50+$New_Currency20+$New_Currency10+$New_Currency5+$New_Currency2+$New_Currency1+$Rolled_CoinSusanb+$Rolled_CoinDollar+$Rolled_CoinFifty+$Rolled_CoinQuarter+$Rolled_CoinDimes+$Rolled_CoinNickels+$Rolled_CoinPennies,2);
$comments = $_POST['comments'];
$message .= "<table border=\"1\">";
$message .= "<tr><td>Requested Delivery Date:</td><td>$DelMonth/$DelDay/$DelYear</td></tr>";
$message .= "<tr><td>Requested By: </td><td><b>$Teller_Id</b> -- $First $Last</td></tr>";
$message .= "<tr><td>Branch</td><td>$Branch</td></tr>";
$message .= "<tr><td>Deposit Ticket -- Currency</td><td>$Deposit_Ticket_Currency</td></tr>";
$message .= "<tr><td>Deposit Ticket -- Coins</td><td>$Deposit_Ticket_Coin</td></tr>";
$message .= "<tr><td>Comments</td><td>$comments</td></tr></table>";
$message .= "<hr><table><tr><td colspan=\"2\"><b>For FIT</b></td></tr>";
$message .= "<tr><td>Ones</td><td>$$FIT1</td></tr>";
$message .= "<tr><td>Twos</td><td>$$FIT2</td></tr>";
$message .= "<tr><td>Fives</td><td>$$FIT5</td></tr>";
$message .= "<tr><td>Tens</td><td>$$FIT10</td></tr>";
$message .= "<tr><td>Twenties</td><td>$$FIT20</td></tr>";
$message .= "<tr><td>Fifties</td><td>$$FIT50</td></tr>";
$message .= "<tr><td>Hundreds</td><td>$$FIT100</td></tr>";
$message .= "<tr><td><b><font color=red>Total</font color></b></td><td><b><font color=red>$$FITTOT</font color></b></td></table>";
$message .= "<hr><table><tr><td colspan=\"2\"><b>For New Currency</b></td></tr>";
$message .= "<tr><td>Ones</td><td>$$New_Currency1</td></tr>";
$message .= "<tr><td>Twos</td><td>$$New_Currency2</td></tr>";
$message .= "<tr><td>Fives</td><td>$$New_Currency5</td></tr>";
$message .= "<tr><td>Tens</td><td>$$New_Currency10</td></tr>";
$message .= "<tr><td>Twenties</td><td>$$New_Currency20</td></tr>";
$message .= "<tr><td>Fifties</td><td>$$New_Currency50</td></tr>";
$message .= "<tr><td>Hundreds</td><td>$$New_Currency100</td></tr>";
$message .= "<tr><td><b><font color=red>Total</font color></b></td><td><b><font color=red>$$New_CurrencyTOT</font color></b></td></tr></table>";
$message .= "<hr><table><tr><td colspan=\"2\"><b>For Rolled Coin</b></td></tr>";
$message .= "<tr><td>Pennies</td><td>$$Rolled_CoinPennies</td></tr>";
$message .= "<tr><td>Nickels</td><td>$$Rolled_CoinNickels</td></tr>";
$message .= "<tr><td>Dimes</td><td>$$Rolled_CoinDimes</td></tr>";
$message .= "<tr><td>Quarters</td><td>$$Rolled_CoinQuarter</td></tr>";
$message .= "<tr><td>Fifty Cent Pieces</td><td>$$Rolled_CoinFifty</td></tr>";
$message .= "<tr><td>Susan B's</td><td>$$Rolled_CoinSusanb</td></tr>";
$message .= "<tr><td>Dollar Coins</td><td>$$Rolled_CoinDollar</td></tr>";
$message .= "<tr><td><font color=red><b>Total</b></font color></td><td><b><font color=red>$$Rolled_CoinTOT</font color></b></td></tr></table>";
$message .= "<table><tr><td><font color=red><b>GRAND TOTAL</b></font color></td><td><b><u><font color=green>$$Grand_Tot</font color></u></b></td></tr></table>";
//<font color=red>.</font color>
if($_POST['SendEmail']=='true'){
echo "<h2>Email has been sent!</h2> <a href=\"http://www.google.com\">Click here to exit</a>";
/*
if($Branch==0000){
$to1 ='[email protected]';
$to1 .='[email protected]';
}
*/
//Arvada
if($Branch==0){
/*$to1 ='[email protected].org,';*/
$to1 ='[email protected],';
$to1 .=' [email protected],';
$to1 .=' [email protected]';
$to1 .=' [email protected]';
}
//Aurora
if($Branch==1){
/*$to1 ='[email protected],';*/
$to1 ='[email protected],';
$to1 .=' [email protected],';
$to1 .=' [email protected],';
$to1 .=' [email protected]';
}
//Littleton
if($Branch==4){
/*$to1 ='[email protected],';*/
$to1 ='[email protected],';
/*$to1 .=' [email protected],';*/
$to1 .=' [email protected],';
$to1 .=' [email protected]';
}
//Stapleton
if($Branch==5){
/*$to1 ='[email protected],';*/
$to1 ='[email protected],';
$to1 .='[email protected],';
$to1 .='[email protected],';
$to1 .=' [email protected]';
}
//Broomfield
if($Branch==8){
/*$to1 ='[email protected],';*/
$to1 ='[email protected],';
$to1 .=' [email protected],';
$to1 .=' [email protected]';
}
//Denverwater
if($Branch==9){
/*$to1 ='[email protected],';*/
$to1 ='[email protected],';
$to1 .=' [email protected],';
$to1 .=' [email protected]';
}
//Sending Actual Email
$subject1 = 'CASHORDER REQUEST';
$headers1 = 'From: Cash Order ' ."\r\n";
$headers1 .= 'Reply-To:' ."\r\n";
$headers1 .= 'MIME-Version: 1.0' . "\r\n";
$headers1 .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail_sent = @mail($to1, $subject1, $message, $headers1);
exit();
}
else { echo $message; }
echo "<table><h2>Please confirm the amounts are correct & hit the <u>Place Cash Order button</u><br>To make changes, hit the back button in your browser</h2>";
echo "<input type=\"submit\" value=\"Place Cash Order\" style=\"width: 150px; height: 100px;\">";
echo "<input type=\"hidden\" name=\"SendEmail\" value=\"true\">";
echo "</td></tr></table>"
?>
在我發佈代碼之後,我注意到沒有逗號......可以在問題上度過一整天。儘管謝謝您的幫助! –