我创建了一个带有引导主题的个人投资组合网站。
它附带预先构建的PHP表单提交,但是我无法使用它,因为我在github.io页面上托管了该网站。
我删除了PHP文件夹/文件并为formspree配置了html。我在表单中的所有输入元素中添加了formspree action = attribute以及name属性。毕竟它仍然无法正常工作。请参阅下面的代码:
<form method="POST" action="https://formspree.io/paulhanna1933@gmail.com" name="sentMessage" id="contactForm" novalidate>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label for="name">Name</label>
<input type="text" class="form-control" name="Name" placeholder="Name" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label for="email">Email Address</label>
<input type="email" class="form-control" name="Email Address" placeholder="Email Address" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label for="phone">Phone Number</label>
<input type="tel" class="form-control" name="Phone Number" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label for="message">Message</label>
<textarea rows="5" class="form-control" name="Message" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="row">
<div class="form-group col-xs-12">
<button type="submit" class="btn btn-success btn-lg">Send</button>
</div>
</div>
</form>
答案 0 :(得分:0)
它正在工作你将尝试在线服务器。它重定向您不希望进行AJAX调用并使用
的Form spree页面<input type="text" name="_gotcha" style="display:none;"/>
_gotcha以避免重新验证。