我已经创建了带有验证和php验证的基本表单。我还向该表单添加了一个重新验证码,因为上次更新表单的安全性后,由于某种原因我收到了很多不适当的垃圾邮件电子邮件。我仍然收到不当的垃圾邮件,因此,我错过了可能会通过表格发送给我的重要电子邮件。
我曾尝试搜索互联网和在线教程,但它们只是告诉我我已经做了什么。我的代码如下:
HTML:
<div class="contact">
<div class="container">
<h2>Contact US</h2>
<div class="contact-form">
<div class="col-md-8 contact-grid">
<form id="test" action="form-process.php" method="POST">
<input name="name" type="text" placeholder="Name" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='name';}" required>
<br>
<input name="email" type="text" placeholder="Email" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='email';}" required>
<br>
<select id="contact" name="dropdown" onchange="handleOption(this)" required>
<option value="" disabled selected>Crew/Gang</option>
<option value="NC Maphia">NC Maphia</option>
<option value="deadeye/index">Dead Eye</option>
</select><br>
<select id="contact" name="dropdown2" required>
<option value="" disabled selected>Game</option>
<option value="Grand Theft Auto V">Grand Theft Auto V</option>
<option value="Red Dead Redemption II">Red Dead Redemption II</option>
</select><br>
<select id="contact" name="dropdown3" required>
<option value="" disabled selected>Platform</option>
<option value="Xbox One">Xbox One</option>
<option value="PS4">PS4</option>
</select><br>
<select id="contact" name="dropdown4" required>
<option value="" disabled selected>Reason For Contacting Us</option>
<option value="Joining NC Maphia">Joining NC Maphia</option>
<option value="Recruitment Requirments">Recruitment Requirments</option>
<option value="Events">Events</option>
<option value="Report A Member">Report A Member</option>
<option value="Webmaster">Webmaster</option>
<option value="General Inquiry">General Inquiry</option>
</select><br>
<input name="subject" type="text" placeholder="Subject" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='subject';}">
<br>
<textarea name="message" cols="77" rows="6" placeholder="Message" onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'message';}" required></textarea>
<span class="msg-error error"></span>
<div id="recaptcha" class="g-recaptcha" data-sitekey="6Ler9H8UAAAAAElg86pX58oN-G2a125GwNoBY9X4"></div>
<div class="send">
<input type="submit" name="submit" value="Send" >
</div>
</form>
</div>
<div class="col-md-4 contact-in">
<div class="address-more">
<h4>Address</h4>
<p>Maze Bank Tower,</p>
<p>Los Santos,</p>
<p>America </p>
</div>
<div class="address-more">
<h4>Chat With Us</h4>
<p>PSN: Kyle-The-Gunman9</p>
<p>PSN: NC_Maphia</p>
<p>Email:<a href="mailto:email@example.com"> email[at]example.com</a></p>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
<script type="text/javascript">
function handleOption(elm) {
if(elm.value == "deadeye/index") { // Check if Dead Eye was selected
console.log("Dead Eye selected, redirecting");
window.location = elm.value + ".html";
}
}
$( '.send' ).click(function(){
var $captcha = $( '#recaptcha' ),
response = grecaptcha.getResponse();
if (response.length === 0) {
$( '.msg-error').text( "Oops You forgot to do the ReCaptcha!" );
if( !$captcha.hasClass( "error" ) ){
$captcha.addClass( "error" );
}
} else {
$( '.msg-error' ).text('');
$captcha.removeClass( "error" );
alert( 'Processing...' );
}
})
</script>
<div class="map">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d37494223.23909492!2d103!3d55!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x453c569a896724fb%3A0x1409fdf86611f613!2sRussia!5e0!3m2!1sen!2sin!4v1415776049771"></iframe>
</div>
</div>
我的PHP代码在pastebin上。您可以在下面查看它
我希望我的联系表单,以便在进行完整验证时,用户无法滥用该表单。如果这样
在此先感谢您的任何帮助。