【发布时间】:2015-11-20 00:29:31
【问题描述】:
目前正在尝试修改 PHP 联系表单插件。我需要让用户能够选择他们想向哪个办公室部门发送电子邮件,并拥有联系信息。转到该特定电子邮件地址。
这个插件在 PHP 中有一个数组,允许发送联系表单信息。到多个电子邮件地址。问题是它发送信息。到数组中的每个电子邮件地址,我需要用户能够在数组中选择一个地址来发送信息。至。
这是 PHP 中的数组:
$recipients = true;
if($recipients == true){
$recipients = array(
'Select department you are trying to reach*' => '',
"example1@gmail.com" => "Parts",
"example2@gmail.com" => "Sales",
"example3@gmail.com" => "Service",
);
foreach($recipients as $email => $name){
$mail->AddBCC($email, $name);
}
}
这是联系表格的设置:
<form method="post" action="php/smartprocess.php" id="smart-form">
<div class="form-body">
<label class="field prepend-icon">
<input type="text" name="sendername" id="sendername" class="gui-input" placeholder="Enter name">
</label>
<label class="field prepend-icon">
<input type="email" name="emailaddress" id="emailaddress" class="gui-input" placeholder="Email address">
</label>
<label class="field">
<input type="text" name="captcha" id="captcha" class="gui-input sfcode" maxlength="6" placeholder="Enter CAPTCHA">
</label>
<label class="button captcode">
<img src="php/captcha/captcha.php?<?php echo time();?>" id="captchax" alt="captcha">
<span class="refresh-captcha"><i class="fa fa-refresh"></i></span>
</label>
<div class="result"></div>
<button type="submit" data-btntext-sending="Sending..." class="button btn-primary">Submit</button>
<button type="reset" class="button"> Cancel </button>
</form>
我如何在此联系表单中添加一个下拉表单,以便有人可以专门选择他们想要向其发送电子邮件的部门(以及从数组中匹配的电子邮件地址)?
非常感谢您的帮助。我完全不知道如何实现这一目标。对于任何好奇的人,我使用的插件称为“智能表单”,他们在这里有一个演示:http://codecanyon.net/item/smart-forms/full_screen_preview/7254656。
【问题讨论】:
标签: php arrays contact-form