$ _POST在wordpress中的表单提交时返回空 [英] $_POST returns empty on form submit in wordpress
本文介绍了$ _POST在wordpress中的表单提交时返回空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表单:
< form action =<?php echo the_permalink();?> 方法= POST >
< input type =textname =namevalue =placeholder =Your First and Last Name */>
<?php echo $ firstnameError; ?>
< input type =textname =emailvalue =placeholder =Yoyr Email/>
<?php echo $ emailError; ?>
< br>
< input type =textname =companyvalue =placeholder =Your Company Name/>
< input type =textname =phonevalue =placeholder =您的电话号码/>
<?php echo $ addressError; ?>
< br>
< input type =radioname =budgetvalue =1500/>
< input type =radioname =budgetvalue =2500/>
< input type =radioname =budgetvalue =5000/>
< input type =radioname =budgetvalue =10000/>
< input type =radioname =budgetvalue =100001/>
< input type =radioname =budgetvalue =not sure/>
< input type =hiddenname =submitvalue =1/>
< input type =submitvalue =SUbmit/>
< / form>
它对同一页面执行操作,但当执行 print_r($ _ POST );
它不会打印任何内容,即 $ _ POST
中没有值。
这可能是什么原因?我在这方面研究了几个问题,但没有人给我我正在寻找的答案。 解决方案
作为Post的价值,wordpress的DOSNT就是这样的!
改变这个
< input type =textname =namevalue =placeholder =Your First and Last Name */>
至
< input type =textname =thenamevalue =placeholder =您的姓名*/>
将名称更改为名称,Will保证工作! ;)
I have a form:
<form action="<?php echo the_permalink(); ?>" method="POST">
<input type="text" name="name" value="" placeholder="Your First and Last Name *" />
<?php echo $firstnameError; ?>
<input type="text" name="email" value="" placeholder="Yoyr Email" />
<?php echo $emailError; ?>
<br>
<input type="text" name="company" value="" placeholder="Your Company Name" />
<input type="text" name="phone" value="" placeholder="Your Phone number" />
<textarea name="project" rows="4" cols="50" placeholder="Describe the scope of work and the most important features of the project *'"></textarea>
<?php echo $addressError; ?>
<br>
<input type="radio" name="budget" value="1500" />
<input type="radio" name="budget" value="2500" />
<input type="radio" name="budget" value="5000" />
<input type="radio" name="budget" value="10000" />
<input type="radio" name="budget" value="100001" />
<input type="radio" name="budget" value="not sure" />
<input type="hidden" name="submit" value="1" />
<input type="submit" value="SUbmit" />
</form>
It actions to the same page, but when I do print_r($_POST);
it does not print anything, i.e. no value in $_POST
.
What could be the reason(s) for this? I studied a few questions on SO on this but none gave me the answer I was looking for.
解决方案
If your passing the name as a Post value, wordpress DOSNT like this!
change this
<input type="text" name="name" value="" placeholder="Your First and Last Name *" />
to
<input type="text" name="thename" value="" placeholder="Your First and Last Name *" />
changing the name to thename, Will work guaranteed! ;)
这篇关于$ _POST在wordpress中的表单提交时返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文