【发布时间】:2015-11-19 16:46:15
【问题描述】:
已编辑:
我有一个使用 HTML/PHP 的联系表。我希望用户能够从下拉菜单中选择一个部门,并将电子邮件发送到该部门的电子邮件地址。
我的问题是:我在 PHP 中的哪个位置指定根据用户下拉选择将信息发送到哪个电子邮件地址。我假设它来自这部分代码:
HTML
<label class="custom-select">
<select name="department">
<option>Technical Issues</option>
<option>Charities</option>
<option>General Inquiries</option>
<option>Other</option>
</select><span><!-- fake select handler --></span>
</label>
</div>
<div class="column-100">
<textarea name="message" placeholder="Type your message here..."></textarea>
</div>
<div class="column-100 center">
<input type="submit" value="Send" data-error="Fix errors" data-processing="Sending..." data-success="Thank you!">
</div>
<footer class="notification-box"></footer>
</form>
</div>
PHP
define('FROM_EMAIL', '');
// Recipient's e-mail. To this e-mail messages will be sent.
// e.g.: john@example.com
// multiple recipients e.g.: john@example.com, andy@example.com
define('TO_EMAIL', 'info@beetheswarm.com');
/**
* Function for sending messages. Checks input fields, prepares message and sends it.
*/
function sendMessage() {
// Variables init
提前致谢。 :)
【问题讨论】:
-
那么你的问题是什么?在你说“我该怎么做?”之前,请记住,这样的问题太宽泛了,因此会被封闭。因此,如果到目前为止您已经编写了任何代码,我强烈建议您将其添加到您的问题中。您应该阅读“how do I ask a good question?”。
标签: php jquery html email contact-form