【问题标题】:reCAPTCHA Displayed in a FORM - Image Needs Padding以表格形式显示的 reCAPTCHA - 图像需要填充
【发布时间】:2013-09-06 01:45:50
【问题描述】:

我有一个功能齐全的 reCAPTCHA 小部件,位于 here。它是更大的 HTML 表单的一部分,我很难调整从以下位置返回的图像:

<?php echo recaptcha_get_html($public_key); ?>

向表单本身添加任何填充/边距会将所有内容向右移动,但我只需要调整小部件。我的答案是否在于我可以围绕这个 PHP 脚本的 CSS 属性?

如果有帮助,我会显示整个表单...提前感谢您提供任何提示或解决方案。

<form id="feedback" method="post" action="">
<p>
    <label for="name">Name:</label>
    <input name="name" id="name" type="text" class="formbox"
    <?php if ($missing || $errors) { 
          if(isset($name)){
            echo 'value="' . htmlentities($name, ENT_COMPAT, 'UTF-8') . '"'; 
          }
        } ?>>
    <?php if ($missing && in_array('name', $missing)) { ?> 
          <span class="warning"><font color="red">Please enter your name</font></span> 
    <?php } ?>
</p>
<p>
    <label for="email">Email:</label>
    <input name="email" id="email" type="text" class="formbox"/
    <?php if ($missing || $errors) { 
          if(isset($email)){
            echo 'value="' . htmlentities($email, ENT_COMPAT, 'UTF-8') . '"'; 
          }
        } ?>>
    <?php if ($missing && in_array('email', $missing)) { ?> 
            <span class="warning"><font color="red">Please enter your email address</font></span> 
    <?php } elseif (isset($errors['email'])) { ?> 
          <span class="warning"><font color="red">Invalid email address</font></span> 
        <?php } ?>
</p>
<p>
    <label for="comments">Comments:
    <?php if ($missing && in_array('comments', $missing)) { ?> 
            <span class="warning"><font color="red">Please enter your comments</font></span> 
    <?php } ?> 
    <br /></label>
    <textarea name="comments" id="comments" cols="60" rows="8"><?php 
          if ($missing || $errors) { 
            if(isset($comments)){
                echo htmlentities($comments, ENT_COMPAT, 'UTF-8'); 
            }
          } ?></textarea>
</p>
<script type="text/javascript">
    var RecaptchaOptions = {
        theme : 'white'
    };
</script>
<?php 
//Display the error message if the values don't match.
if (isset($errors['recaptcha'])) { ?> 
    <p><font color="red">The values didn't match. Try again.</font></p>
<?php } ?>

<?php echo recaptcha_get_html($public_key); ?>
<p>
  <input name="send" id="send" type="submit" value="Send message" />
</p>
</form>

【问题讨论】:

    标签: php css forms recaptcha


    【解决方案1】:

    这正是你需要的..

    CSS

    #recaptcha_widget_div {
        margin-left: 18px;
    }
    

    HTML

    <div id="recaptcha_widget_div">
        <?php echo recaptcha_get_html($public_key); ?>
    </div>
    

    【讨论】:

    • 乔希,这很好——我以为我已经简单地尝试过了,但我一定遇到了一些语法问题。将 php 脚本包装在您定义的 div 中,并且完美排列。非常感谢。
    • @Bonedancer 很高兴它有帮助!
    猜你喜欢
    • 2012-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-26
    • 1970-01-01
    • 2015-04-06
    • 2019-05-09
    • 2017-12-14
    相关资源
    最近更新 更多