【发布时间】:2016-07-02 07:07:30
【问题描述】:
我有一个简单的网站表单,允许用户向我的客户电子邮件地址发送查询/消息。
我正在努力让它发挥作用。到目前为止,我已经设法找到一些代码(也通过堆栈溢出),允许表单在提交时将空白电子邮件发送到正确的地址。我似乎遗漏了一些代码或使提交按钮从表单中提取信息以发送的内容。
下面是我的代码。
谢谢(PS 我没有使用 PHP 的经验,只是为了改变我之前找到的代码来实现这一点)。
<?php
mail('chameleonyeadon@gmail.com', $_POST['name'], $_POST['email'], $_POST['number'], $_POST['message']);
?>
<form method="post" action="email.php" enctype="text/plain">
<!-- name-->
<label class="contact__form--label"><em>What is your name?</em><br>
<input type="text" name="name" class="contact__form__inputbox contact__form__inputbox--marg contact__form__inputbox--pad" placeholder="Enter your name here" maxlength="30" required="required"/></label><br>
<!-- email-->
<label class="contact__form--label"><em>Do you have an email address?</em><br>
<input type="email" name="email" class="contact__form__inputbox contact__form__inputbox--marg contact__form__inputbox--pad" placeholder="Enter your email address here" maxlength="50" required="required"/></label><br>
<!-- number-->
<label class="contact__form--label"><em>Can we contact you by phone?</em><br>
<input type="number" name="number" class="contact__form__inputbox contact__form__inputbox--marg contact__form__inputbox--pad" placeholder="Enter a phone number we can use here" maxlength="50" required="required"/></label><br>
<!-- message-->
<label class="contact__form--label"><em>What is your message?</em><br>
<textarea name="message" required="required" class="contact__form__inputbox contact__form__inputbox--marg contact__form__textarea contact__form__inputbox--pad" placeholder="Enter your message here"></textarea></label><br>
<div class="contact__form__btns">
<input type="submit" value="Send" class="btn btn--brdr btn--padding--less">
<input type="reset" value="Clear" class="btn btn--brdr btn--padding--less btn__formpos">
</div>
</form>
【问题讨论】:
标签: php html forms email submit