我正处于一个我已经工作了大约 2 周的项目的最后阶段。我的 HTML 表单已创建并在功能上与 PHP 完全兼容。目前,在提交表单后,它会回显结果。在这一点上,我不知道下一步该去哪里。
我希望能够从该页面获取信息,并添加数字数字签名(很像 PIN)并使用 PHP 将最终结果提交到电子邮件中。
我可以分别做这两个。IE - 我可以创建一个表单来回显结果,我可以创建一个立即通过电子邮件发送结果的表单,但我不明白如何将它们结合起来。
如何在添加数字签名的同时将表单的回显结果作为电子邮件提交?
(由于我没有提供代码,因为我对 PHP 很陌生,我不希望任何人为我做这件事,但我很难通过谷歌搜索找到相关信息,所以即使指向我的权利方向会非常有帮助。)
谢谢
现在我知道得更多了。所有代码:
HTML
<form action="echo_form_email.php" method="GET">
<p>
<div id="cheddar">Cashier: <input id="cashier" name="cashier" type="text"></div>
</p>
<P>
<div id="q">Did the cashier front the register?</div>
<div id="radio1"><input type="checkbox" name="front_register" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="front_register" value="No">No</div>
<div id="radio3"><input type="checkbox" name="front_register" value="N/A">N/A</div>
</p>
<p>
<div id="q">Genuinely greet customer with eye contact?</div>
<div id="radio1"><input type="checkbox" name="greets" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="greets" value="No">No</div>
</p>
<p>
<div id="q">Scan/unload B.O.B. (If no bagger)</div>
<div id="radio1"><input type="checkbox" name="scan_bob" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="scan_bob" value="No">No</div>
<div id="radio3"><input type="checkbox" name="scan_bob" value="N/A">N/A</div>
</p>
<p>
<div id="q">Carry conversation around product in basket or genuine conversation?</div>
<div id="radio1"><input type="checkbox" name="conversation" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="conversation" value="No">No</div>
<div id="radio3"><input type="checkbox" name="conversation" value="N/A">N/A</div>
</p>
<p>
<div id="q">Offer buddy bucks to parent at beginning of order?</div>
<div id="radio1"><input type="checkbox" name="buddy" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="buddy" value="No">No</div>
<div id="radio3"><input type="checkbox" name="buddy" value="N/A">N/A</div>
</p>
<p>
<div id="q">Avoid side conversations?</div>
<div id="radio1"><input type="checkbox" name="side_conversation" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="side_conversation" value="No">No</div>
</p>
<p>
<div id="q">Point out and circle savings?</div>
<div id="radio1"><input type="checkbox" name="savings" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="savings" value="No">No</div>
<div id="radio3"><input type="checkbox" name="savings" value="N/A">N/A</div>
</p>
<p>
<div id="q">Offer carryout (if no bagger)?</div>
<div id="radio1"><input type="checkbox" name="carry_out" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="carry_out" value="No">No</div>
<div id="radio3"><input type="checkbox" name="carry_out" value="N/A">N/A</div>
</p>
<p>
<div id="q">Give a genuine "thank you"?</div>
<div id="radio1"><input type="checkbox" name="thanks" value="Yes">Yes</div>
<div id="radio2"><input type="checkbox" name="thanks" value="No">No</div>
</p>
<p>
<div id="cheddar">Digital Signature</div>
<div id="cheddar"><input type="tel" name="sign1" placeholder="Peoplesoft ID"></div>
</p>
<p>
<div id="auditingasm">ASM performing audit: <br />
<select name="asm">
<option value="John Doe">John Doe</option>
<option value="Jane Doe">Jane Doe</option>
<option value="Little Doe">Little Doe</option>
<option value="Big Doe">Big Doe</option>
</select></div>
</p>
<br />
<input type="submit" value="submit" name="submit">
<input id="reset" type="reset">
</form>
PHP 表单回显
<?PHP
if (! empty($_GET['cashier'])){
echo 'Cashier receiving audit: ' . $_GET['cashier'];
}
echo "<br />";
if (! empty($_GET['asm'])){
echo 'ASM performing audit: ' . $_GET['asm'];
}
echo "<br /><Br />";
if (! empty($_GET['front_register'])){
echo 'Did cashier front the register? ' . $_GET['front_register'];
}
echo "<br />";
if (! empty($_GET['greets'])){
echo 'Greet customer with eye contact? ' . $_GET['greets'];
}
echo "<br />";
if (! empty($_GET['scan_bob'])){
echo 'Scan/Unload BOB (if no bagger) ' . $_GET['scan_bob'];
}
echo "<br />";
if (! empty($_GET['conversation'])){
echo 'Conversation about groceries, or other genuine conversation? ' . $_GET['conversation'];
}
echo "<br />";
if (! empty($_GET['buddy'])){
echo 'Offer Buddy bucks to parent at beginning of order? ' . $_GET['buddy'];
}
echo "<br />";
if (! empty($_GET['side_conversation'])){
echo 'No side conversations? ' . $_GET['side_conversation'];
}
echo "<br />";
if (! empty($_GET['savings'])){
echo 'Cashier pointed to and circled savings? ' . $_GET['savings'];
}
echo "<br />";
if (! empty($_GET['carry_out'])){
echo 'Offered carry out (if no bagger) ' . $_GET['carry_out'];
}
echo "<br />";
if (! empty($_GET['thanks'])){
echo 'Genuine "thank you?" ' . $_GET['thanks'];
}
echo "<br /><Br />";
if (! empty($_GET['sign1'])){
echo 'Digital Signature: ' . $_GET['sign1'];
}
?>
PHP 表单电子邮件
这是附加到表单的原始 php,它通过电子邮件发送到正确的地址以使表单可打印。这个之前的代码是用于回声的 PHP,正如 @Death 今天早些时候在另一个论坛上看到的那样。<?
//---------------
// Cashier Audit
//---------------
$msg .= "Cashier being audited: ".$_POST["cashier"]."";
$msg .= "\n\nFront the register? $front_register\n";
$msg .= "Greet customer with eye contact? $greets\n";
$msg .= "Scan/Unload BOB (if no bagger) $scan_bob\n";
$msg .= "Conversation about groceries, or other genuine conversation? $conversation\n";
$msg .= "Offer Buddy bucks to parent at beginning of order? $buddy\n";
$msg .= "No Side Conversations? $side_conversation\n";
$msg .= "Cashier pointed to and circled savings? $savings\n";
$msg .= "Offered carry out (if no bagger)? $carry_out\n";
$msg .= "Genuine Thank You? $thanks\n\n";
$msg .= "**************************************************************\n";
$msg .= "\n\n\nCashier signature:__________________________";
$msg .= "\n $cashier";
$msg .= "\n\n\n\n\nASM signature:__________________________";
$msg .= "\n $asm";
//-----------------
// Signature Lines
//-----------------
.= $checkbox=$_POST['checkbox'];
.= $asm = $_POST['asm'];
$to = "email@address.com";
$from = "other@email.com";
$subject = "Service Audit";
$mailheaders = "From: \"$asm\" <$from> . \n";
//$mailheaders .= "Reply-To: $from\n\n";
mail($to, $subject, $msg, $mailheaders);
?>