我已经制作了这样的邮件表格
<?php
//session_start();
$Total = $_POST['Total'];
$room = $_POST['room'];
$letter = $_POST['letter'];
$Name = $_POST['name'];
$Email = $_POST['email'];
$Address = $_POST['address'];
$Message = $_POST['message'];
$body = "Message sent from CARBONYZED Quotation System | www.CARBONYZED.co.uk ". "\r\n".
"// Number of $room = Sel". $letter. " \r\n".
"// Quote Total = ". $Total. " \r\n".
"// Name = ". $Name. " \r\n".
"// Email = ". $Email. " \r\n".
"// Address = ". $Address. " \r\n".
"// Message = ". $Message. " \r\n".
$subject = "**CONTACT FORM** - From CARBONYZED's Web Server";
$to = "AffordableCleaners@carbonyzed.co.uk";
$headers = 'AffordableCleaners@carbonyzed.co.uk' . "\r\n" .
'Reply-To: AffordableCleaners@carbonyzed.co.uk' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $Email, $body, $headers)) {
echo("<p>Message successfully sent!</p> Click here to go <a href='http://www.affordablecleaners.co.uk'>back</a>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
除了我需要添加更多功能外,哪个很棒。在上一页上,我有一些框,我将在这里发布
<tr>
<td align="left">Stairs</td>
<td align="center" style="text-align: left">
<select name="SelA">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<input type="hidden" name="TotA" onFocus="this.blur();" />
<br></td>
<td width="120" align="center" style="text-align: left">
<select name="SelAA">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<input type="hidden" name="TotAA" onFocus="this.blur();" />
<br></td>
<td width="116" align="center" style="text-align: left">
<select name="SelUA">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<input type="hidden" name="TotUA" onFocus="this.blur();" />
<br></td>
</tr>
请你可以帮我做两件事,首先拉出楼梯发送内容(如楼梯)和邮件,还有3个值,每个内容为每个沮丧......
此外,我们可能会添加一些具有相似数据的所有数据,但不完全相同。基本上,Stairs格式的名称文本值将始终是随机的,但SelA和SelUA将始终在变化。基本上我们需要它循环中间的所有内容并提取这些4位信息(或8,12,16 ......
希望有人疯狂的大脑可以提供帮助
此致
亨利
答案 0 :(得分:2)
提交前的上一页中的每个表单选项(无论是POST还是GET)都将包含在下一页的名称中。就像PHP顶部的语句一样,您可以获得框的值:
$SelA= $_POST['SelA'];
$SelAA= $_POST['SelAA'];
$SelUA= $_POST['SelUA'];
然后你就可以在身体中使用这些值,就像你已经拥有的那样:
$body = "Message sent from CARBONYZED Quotation System | www.CARBONYZED.co.uk ". "\r\n".
"// Number of $room = Sel". $letter. " \r\n".
"// Quote Total = ". $Total. " \r\n".
"// Name = ". $Name. " \r\n".
"// Email = ". $Email. " \r\n".
"// Address = ". $Address. " \r\n".
"// Message = ". $Message. " \r\n".
"// SelA= ". $SelA. " \r\n".
"// SelAA= ". $SelAA. " \r\n".
"// SelUA= ". $SelUA. " \r\n".
这是你在找什么?
答案 1 :(得分:0)
修改表单页面以将输入字段抛出到数组中:
<select name="Sel[A]"> ...
<select name="Sel[AA]"> ...
<select name="Sel[XA]"> ...
然后附上一个循环:
foreach ($_POST["Sel"] as $key => $value) {
$email_body .= "// Stairs? $Sel $key = $value \r\n";
}
是的,这是用字符串连接变量的非麻烦方法。