2013-04-04 87 views
4

提交我有一個表格:

<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> 

它的動作相同的頁面,但是當我做print_r($_POST);它不顯示任何信息,在$_POST即沒有價值。

這可能是什麼原因?我在這個問題上研究了幾個問題,但沒有人給我我正在尋找的答案。

+0

你忘掉了'i'在'action'屬性 – JoDev 2013-04-04 12:22:38

+0

@JoDev這是一個錯字 – 2013-04-04 12:25:13

+5

非官方#1#規則(而不是** **阿克頓「行動」) 1,**不要輸入問題。總是,我總是重複複製/粘貼** – itachi 2013-04-04 12:35:03

回答

4

如果通過名字作爲郵政值,WordPress的DOSNT這個樣子!

改變這種

<input type="text" name="name" value="" placeholder="Your First and Last Name *" /> 

<input type="text" name="thename" value="" placeholder="Your First and Last Name *" /> 

改變thename,將努力保證! ;)

+1

你好冠軍.. !!!它工作 – 2013-04-04 12:53:35

+0

優秀;)wordpress不喜歡名稱值被傳遞,總是很好使用自己的命名約定。 M – Marty 2013-04-04 13:19:53

+0

保留字詞的完整列表在這裏: https://codex.wordpress.org/Reserved_Terms – richplane 2015-06-08 16:24:57

3

改變這種

acton="<?php echo the_permalink(); ?>" 

action="<?php echo the_permalink(); ?>" 
+0

這是一個錯字...它的實際行動的形式 – 2013-04-04 12:24:38

+1

你不回聲'the_permalink()' – RRikesh 2013-04-04 12:25:19

2
<form action="<?php the_permalink(); ?>" method="POST"> 

你不需要呼應the_permalink()

這個工作對我來說:

<?php print_r($_POST);?> 
<form action="" 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> 
+0

仍然是相同的..沒有結果$ _POST – 2013-04-04 12:26:03

+0

更改名稱輸入變量是唯一的東西。它有時與WordPress的保留名稱 – RRikesh 2013-04-04 12:26:47

+0

nopes ...仍然相同:( – 2013-04-04 12:29:59

-3

SOLUTION:

由於要求的問題,在WordPress網站,而不是

<form action="http://example.com/">... 

您可能需要點PHP文件..例如:

<form action="http://example.com/index.php">... 


////// ps回聲自動the_permalink()完成[相同的是:echo get_permalink()