我找不到确切的答案,而且我自己也不是开发人员,所以这可能很简单,我做错了。
我创建了一个表单,它可以使用 jquery 动态添加一组字段并克隆标签,如下所示:
<div class="container"><li id="li_6" >
<label class="description" for="element_6">Advert Title (Up to 35 characters including spaces) </label>
<input id="element_6" name="element_6[]" class="element text medium" type="text" maxlength="255" value=""/>
</li> <li id="li_7" >
<label class="description" for="element_7">Advert Body Text (Up to 70 characters including spaces) </label>
<textarea id="element_7[]" name="element_7" class="element textarea small"></textarea>
</li> <li id="li_8" >
<label class="description" for="element_8">Advert Keywords (These are the words or phrases your potential customers will search for. Only 1 per line) </label>
<textarea id="element_8[]" name="element_8" class="element textarea medium"></textarea>
<a href="#" id="add">
Click to Add Another Advert</a> <a href="#" id="remove">| Remove Last Advert</a>
</li>
所有这一切都很好,唯一的问题是当电子邮件功能运行时,我只得到最新添加的字段组,而不是收到的电子邮件中的所有字段:
if($act=="post"){
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: 123Click<support@123click.co.za>' . "\r\n";
$to = 'support@123click.co.za';
$subject ='New Adwords Setup';
$message = "<b><u>Section A: Login</u></b> ".'<br>';
$message = "<b>Login Email:</b> ".$_POST["element_1"].'<br>';
$message = "<b><u>Section B: Settings</u></b> ".'<br>';
$message .= "<b>Location:</b> ".$_POST["element_9"].'<br>';
$message .= "<b>Daily Budget:</b> ".$_POST["element_10"].'<br>';
$message .= "<b>Web Address:</b> ".$_POST["element_4"].'<br>';
$message = "<b><u>Section C: Adverts</u></b> ".'<br>';
$message .= "<b>Advert Title:</b> ".$_POST["element_6"].'<br>';
$message .= "<b>Advert Body:</b> ".$_POST["element_7"].'<br>';
$message .= "<b>Advert Keywords:</b> ".$_POST["element_8"].'<br>';
mail($to, $subject, $message, $headers);
我做错了什么,请尽可能简单地解释。谢谢