隐藏类型输入值未在php中传递

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了隐藏类型输入值未在php中传递脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个联系表格,它有一个非常简单验证码系统,例如“太阳热或冷吗?”用户进入热门.我在tyPE =“hidden”字段中包含原始问题和答案以下处理表单.

问题是这些输入字段在以下PHP页面上始终为空白.这是我在联系表格上的代码

<form id="contact-form" name="contact-form" method="POST" onsubmIT="return true;" action="submit.PHP">
    <fieldset>
        [...]Removed For Convenience[...]
        <label class="captcha" id="captcha" name="captcha">
            <span style="color:#FFFFFF">Is the sun hot or cold?</span>
            <input type="text" value="hot" name="answer" id="answer">
            <input type="hidden" value="Is the sun hot or cold?" name="realquestion" id="realquestion">
                <input type="hidden" value="hot" name="realanswer" id="realanswer">
            <p>Please answer as simply as possible; hot,cold,z,etc. (This question is for security purposes)</p>
        </label><br>
    <div class="clear-form"></div>
        <div class="buttons-wrapper">
            <input id="button-2" type="submit" value="Submit">
        </div>
    </fieldset>
</form>

在接下来的页面中,submit.PHP我把它放在最顶层的“PRint_r($_ POST);”这是返回的数组:

Array ( [Name] => asasasas [Email] => My.Email@gmail.COM [contactTime] => Best Time To Contact You? [Phone] => Phone: [Account] => Account: [OS] => [Department] => [Message] => Message: [answer] => hot [realquestion] => [realanswer] => )

现在是踢球者,如果在我的联系页面上,我将type =“hidden”更改为type =“text”这两个字段,其他任何代码都无效.一旦完成,我可以将其更改回type =“hidden”,它将继续为该会话工作.如果我切换浏览器,重新启动浏览器,或转到另一台计算机,它将返回到无法读取这些隐藏的输入字段.

有没有人遇到这个或知道可能会发生什么?我不知所措.我真的想弄清楚这个问题,而不是使用像javascript验证这样的解决方法,我已经这样做但我希望PHP检查到位,以他们有javascript关闭(我假设我们已经获得的机器人垃圾邮件有它关闭).

通过改变解决了问题
<input type="hidden" value="Is the sun hot or cold?" name="realquestion" id="realquestion">
            <input type="hidden" value="hot" name="realanswer" id="realanswer">

<input type="hidden" value="Is the sun hot or cold?" name="realquestion" id="realquestion" **/>**
            <input type="hidden" value="hot" name="realanswer" id="realanswer" **/>**

而不是被浏览器缓存绊倒.

脚本宝典总结

以上是脚本宝典为你收集整理的隐藏类型输入值未在php中传递全部内容,希望文章能够帮你解决隐藏类型输入值未在php中传递所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。