2016-07-07 63 views
0

首先发布在这里,非常新的PHP,所以如果我的代码是错误的/基本的道歉。通过电子邮件发送“echo'd”页面

我正在设置审计页面。我希望提交表单并将信息显示为用户的HTML,这是我设法做到的。我也希望通过电子邮件将相同的页面/信息发送到我自己的电子邮件地址。所有将要使用审计页面的用户都使用outlook,所以我不需要发送邮件主机/服务器 - 只是一个包含该信息的弹出电子邮件。

该代码可能写得很差,因为这是我第一次使用PHP,所以如何改进的任何建议都会受到欢迎。但是,正如所解释的那样,我想要在邮件正文中打开/发送一封电子邮件,其中包含确切的信息。

在此先感谢您的帮助!

<?php 

{ 
$clx_hlr = $_POST['clx-hlr']; 
     echo "<font color='green'><b>$clx_hlr</b></font><br>"; 
$tyntec_hlr = $_POST['tyntec-hlr']; 
     echo "<font color='green'><b>$tyntec_hlr </b></font><br>"; 
$mythum_hlr = $_POST['mythum-hlr']; 
     echo "<font color='green'><b>$mythum_hlr </b></font><br>"; 
$tyntec_premium_hlr = $_POST['tyntec-premium-hlr']; 
     echo "<font color='green'><b>$tyntec_premium_hlr </b></font><br>"; 
$tele2_hlr = $_POST['tele2-hlr']; 
     echo "<font color='green'><b>$tele2_hlr </b></font><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
$pfi_sub = $_POST['pfi-sub']; 
     echo "<font color='green'><b>$pfi_sub </b></font><br>"; 
$pfi_onetime = $_POST['pfi-onetime']; 
     echo "<font color='green'><b>$pfi_onetime </b></font><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['mbill-msg-sent']) && $_POST['mbill-msg-sent'] == 'Yes') 
     echo "<font color='green'><b>Mbill msg Sent </b></font><br>"; 
else 
     echo "<font color='red'><b>MBILL MSG NOT SENT </b></font><br>"; 
if (isset($_POST['mbill-email-received']) && $_POST['mbill-email-received'] == 'Yes') 
     echo "<font color='green'><b>Mbill email received </b></font><br>"; 
    else 
     echo "<font color='red'><b>MBILL EMAIL NOT RECEIVED </b></font><br>"; 
if (isset($_POST['mbill-dlr-received']) && $_POST['mbill-dlr-received'] == 'Yes') 
     echo "<font color='green'><b>Mbill dlr received </b></font><br>"; 
    else 
     echo "<font color='red'><b>MBILL DLR NOT RECEIVED </b></font><br>"; 
     echo "<br>"; 
$mbill_notes = $_POST['mbill-notes']; 
     echo "<b><u>Mbill Notes:</u><br> $mbill_notes </b><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['junglepay-sms-sent']) && $_POST['junglepay-sms-sent'] == 'Yes') 
     echo "<font color='green'><b>Junglepay sms sent </b></font><br>"; 
    else 
     echo "<font color='red'><b>JUNGLEPAY SMS NOT SENT </b></font><br>"; 
if (isset($_POST['junglepay-received-password']) && $_POST['junglepay-received-password'] == 'Yes') 
     echo "<font color='green'><b>Junglepay password received </b></font><br>"; 
    else 
     echo "<font color='red'><b>JUNGLEPAY PASSWORD NOT RECEIVED </b></font><br>"; 
if (isset($_POST['junglepay-confirmation-received']) && $_POST['junglepay-confirmation-received'] == 'Yes') 
     echo "<font color='green'><b>Junglepay confirmation received </b></font><br>"; 
    else 
     echo "<font color='red'><b>JUNGLEPAY CONFIRMATION NOT RECEIVED </b></font><br>"; 
     echo "<br>"; 
$junglepay_notes = $_POST['junglepay-notes']; 
     echo "<b><u>Junglepay Notes:</u><br> $junglepay_notes </b><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['menable-sms-sent']) && $_POST['menable-sms-sent'] == 'Yes') 
     echo "<font color='green'<b>>mEnable sms sent </b></font><br>"; 
    else 
     echo "<font color='red'><b>MENABLE SMS NOT SENT </b></font><br>"; 
if (isset($_POST['menable-received-password']) && $_POST['menable-received-password'] == 'Yes') 
     echo "<font color='green'><b>mEnable password received </b></font><br>"; 
    else 
     echo "<font color='red'><b>MENABLE PASSWORD NOT RECEIVED </b></font><br>"; 
if (isset($_POST['menable-confirmation-received']) && $_POST['menable-confirmation-received'] == 'Yes') 
     echo "<font color='green'><b>mEnable confirmation received </b></font><br>"; 
    else 
     echo "<font color='red'><b>MENABLE CONFIRMATION NOT RECEIVED </b></font><br>"; 
     echo "<br>"; 
$menable_notes = $_POST['menable-notes']; 
     echo "<b><u>mEnable Notes:</u><br> $menable_notes </b>><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['cp-bulk-push']) && $_POST['cp-bulk-push'] == 'Yes') 
     echo "<font color='green'><b>CP Bulk push working </b></font><br>"; 
    else 
     echo "<font color='red'><b>CP BULK PUSH NOT WORKING </b></font><br>"; 
if (isset($_POST['cp-account-balance']) && $_POST['cp-account-balance'] == 'Yes') 
     echo "<font color='green'><b>CP Account balance working </b></font><br>"; 
    else 
     echo "<font color='red'><b>CP ACCOUNT BALANCE NOT WORKING </b></font><br>"; 
if (isset($_POST['cp-traffic-reports']) && $_POST['cp-traffic-reports'] == 'Yes') 
     echo "<font color='green'><b>CP Traffic reports working </b></font><br>"; 
    else 
     echo "<font color='red'><b>CP TRAFFIC REPORTS NOT WORKING </b></font><br>"; 
if (isset($_POST['cp-junglepay']) && $_POST['cp-junglepay'] == 'Yes') 
     echo "<font color='green'><b>CP Junglepay working </b></font><br>"; 
    else 
     echo "<font color='red'><b>CP JUNGLEPAY NOT WORKING </b></font><br>"; 
if (isset($_POST['cp-mbill']) && $_POST['cp-mbill'] == 'Yes') 
     echo "<font color='green'><b>CP Mbill working </b></font><br>"; 
    else 
     echo "<font color='red'><b>CP MBILL NOT WORKING </b></font><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
$network_data = $_POST['network-data']; 
     echo "<b><u>Network Data</u><br> $network_data </b><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['v1-xml-check']) && $_POST['v1-xml-check'] == 'Yes') 
     echo "<font color='green'><b>V1 XML Checked </b></font><br>"; 
    else 
     echo "<font color='red'><b>V1 XML NOT CHECKED </b></font><br>"; 
if (isset($_POST['v1-xml-validate']) && $_POST['v1-xml-validate'] == 'Yes') 
     echo "<font color='green'><b>V1 XML Validated </b></font><br>"; 
    else 
     echo "<font color='red'><b>V1 XML NOT VALIDATED </b></font><br>"; 
     echo "<br>"; 
$v1_page_load = $_POST['v1-page-load']; 
     echo "$v1_page_load <br>"; 
$v1_auto_generate = $_POST['v1-auto-generate']; 
     echo "$v1_auto_generate <br>"; 
$v1_validation = $_POST['v1-validation']; 
     echo "$v1_validation <br>"; 
     echo "<br>"; 
$v1_other_notes = $_POST['v1-other-notes']; 
     echo "<b><u>V1 Other Notes:</u><br>$v1_other_notes </b><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['v2-xml-check']) && $_POST['v2-xml-check'] == 'Yes') 
     echo "<font color='green'><b>V2 XML Checked </b></font><br>"; 
    else 
     echo "<font color='red'><b>V2 XML NOT CHECKED </b></font><br>"; 
if (isset($_POST['v2-xml-validate']) && $_POST['v2-xml-validate'] == 'Yes') 
     echo "<font color='green'><b>V2 XML Validated <</b>/font><br>"; 
    else 
     echo "<font color='red'><b>V2 XML NOT VALIDATED </b></font><br>"; 
     echo "<br>"; 
$v2_page_load = $_POST['v2-page-load']; 
     echo "$v2_page_load <br>"; 
$v2_auto_generate = $_POST['v2-auto-generate']; 
     echo "$v2_auto_generate <br>"; 
$v2_validation = $_POST['v2-validation']; 
     echo "$v2_validation <br>"; 
     echo "<br>"; 
$v2_other_notes = $_POST['v2-other-notes']; 
     echo "<b><u>V2 Other Notes:</u> $v2_other_notes </b></font><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['imsi-misses-check']) && $_POST['imsi-misses-check'] == 'Yes') 
     echo "<font color='green'><b>Imsi misses checked </b></font><br>"; 
    else 
     echo "<font color='red'><b>IMSI MISSES NOT CHECKED </b></font><br>"; 
$imsi_misses_notes = $_POST['imsi-misses-notes']; 
     echo "<b><u>IMSI Misses Notes:</u><br> $imsi_misses_notes </b><br>"; 
     echo "<br>"; 
     echo "<br>"; 
     echo "<br>"; 
if (isset($_POST['greentree-currency-check']) && $_POST['greentree-currency-check'] == 'Yes') 
     echo "<font color='green'><b>Greentree Currency checked </b></font><br>"; 
    else 
     echo "<font color='red'><b>GREENTREE CURRENCY NOT CHECKED </b></font><br>"; 
$greentree_currency_notes = $_POST['greentree-currency-notes']; 
     echo "<b><u>Greentree Currency Notes:</u><br>$greentree_currency_notes </b></font><br>"; 

}; 
?> 
+5

这是**糟糕的代码设计**请使用模板将标记与应用程序的逻辑分开。你的生活会更容易:) –

+0

你能给我一个例子或链接?正如我解释过的,我从来没有碰到过PHP,所以我不确定这样的表单是如何设计的 –

回答

0

尝试捕捉使用PHP函数ob_start();输出(其缓冲输出,把这个在你的脚本的开始)。 然后在运行整个脚本之后,使用ob_get_contents()将整个输出放入一个字符串中,并使用mail()函数将它发送给您。