【发布时间】:2020-04-26 23:27:43
【问题描述】:
您好,我的 html 表单有一个非常奇怪的问题。我正在使用 Wordpress,并创建了我的自定义 html 表单。当我提交表单时,它会将我重定向到同一页面 url,但显示该页面不存在。
我的表格:
<form action="" method="post">
<div class="form-group">
<input type="text" name="name" class="form-control input-text" placeholder="Vaše jméno a příjmení" />
<div class="validation"></div>
</div>
<div class="form-group">
<input type="email" class="form-control input-text" name="email" placeholder="Váš e-mail" />
<div class="validation"></div>
</div>
<div class="form-group">
<input type="text" class="form-control input-text" name="subject" placeholder="Předmět zprávy" />
<div class="validation"></div>
</div>
<div class="form-group">
<textarea class="form-control input-text text-area" name="message" rows="5" placeholder="Vaše zpráva pro nás..."></textarea>
<div class="validation"></div>
</div>
<div class="row">
<!-- Google reCAPTCHA widget -->
<div class="col-lg-8 col-sm-8">
<!-- recaptcha here -->
</div>
<div class="col-lg-4 col-sm-4" style="padding-right: 0; padding-left: 0;">
<div class="text-center" style="margin-right: 7px;"><button name="submit" style="width: 135px; height: 75px; padding:0 !important;" type="submit" class="input-btn">Odeslat</button></div>
</div>
</div>
</form>
我试图隐藏我所有的 php 代码,也隐藏 google recaptcha,但没有任何效果,问题出在其他地方。我的action也是空的,只是set方法。
出了什么问题,有什么建议吗?
【问题讨论】:
-
“但显示该页面不存在”如 404?还是因为它不接受 POST?
-
404 错误,我有自定义页面显示 404 错误。我没有使用 Wordpress 中的表单的经验,所以我不确定这样做是否可以
-
你有没有试过省略 action="" ?
-
action=""是无效的表单设置。只需省略 action 属性即可。