小编Ade*_*laP的帖子

将reCAPTCHA v2添加到我的PHP文件中

PHP问题已经解决了.以下是我正在使用的HTML和PHP代码:

contact_form.html:

<html>
<head>
    <title>My Contact Form</title>
    <script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
    <div class="contact-form">
        <h3>Send me your message</h3>
        <form action="app/contact.php" method="POST">
            <div class="text-fields">
                <span>Full Name *:</span>
                <input name="full_name" type="text" class="text" value="Your Name">
            </div>
            <div class="text-fields">
                <span>E-mail *:</span>
                <input name="email" type="text" class="text" value="user@domain.com">
            </div>
            <div class="clearfix"> </div>
            </div>
                <div class="subject-field">
                <span>Subject *:</span>
                <input name="subject" type="text" class="text" value="Your Subject">
            </div>
            <div class="message-field">
                <span>Message *:</span>
                <textarea name="message"> </textarea>
            </div>
            <div class="g-recaptcha" data-sitekey="SITE-KEY-HERE"></div>
            <input type="submit" value="Send" />
        </form>
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是更新的PHP.有了这个,我也得到了我想要的"发件人姓名".

contact_form.php:

<?php
    $full_name;$email;$subject;$message;$captcha; …
Run Code Online (Sandbox Code Playgroud)

html php captcha recaptcha

6
推荐指数
1
解决办法
5166
查看次数

标签 统计

captcha ×1

html ×1

php ×1

recaptcha ×1