html5表单没有反应提交

时间:2012-08-12 19:19:38

标签: php jquery forms html5 form-submit

我有一个简单的单页表单,我写过几十次,但这种行为对我来说是全新的。首先,它是在页面加载时提交,因此自动重定向到系列中的下一页。我仍然不确定我是如何停下来的,但现在当你点击“提交”时它根本没有做任何事情。页面只是坐在那里。

我已经尝试剥离错误检查脚本,显示/隐藏脚本,甚至是jquery本身,然后将表单简化为一个输入。我试图摆脱重定向,只是让它输出一个简单的线,然后vardump,仍然没有。我点击提交,无论我做什么,页面就坐在那里。我以前从未遇到这样的行为,而firebug等人没有给我任何错误或线索。

如果有人有任何想法,无论多么疯狂,我都愿意尝试。我不知所措。提前谢谢!

<?php
session_start();
include('functions.php');

if ($_POST['submit']) {
    $company = $_POST['company'];
   $taxid = $_POST['taxid'];
   header("location:step2.php");
}
include('head.php'); ?>

<form method="post" name="basic" action="step1.php">

<div class="col70">
   <label for="company">Organization/Business name <img src="img/req.jpg" alt="required"></label>
   <input type="text" name="company" id="company" value="" />
</div>

<div class="col30">
   <label for="taxid">Taxpayer ID# (IEN or SS#) <img src="img/req.jpg" alt="required"></label>
   <input type="text" name="taxid" id="taxid" value="" />
</div>

<div class="newcol">
   <label for="address">Mailing Address <img src="img/req.jpg" alt="required"></label>
   <input type="text" name="address" id="address" value="" />
</div>

<div class="col30 newcol">
   <label for="city">City <img src="img/req.jpg" alt="required"></label>
   <input type="text" name="city" id="city" value="" />
</div>

<div class="col30">
   <label for="state">State <img src="img/req.jpg" alt="required"></label>
   <select name="state" id="state" tabindex="<?php echo $tabin; $tabin++; ?>">
       <option value="0"></option>
       <option value="1">Alabama</option>
   </select>
</div>

<div class="col25">
   <label for="zipcode">Zip Code <img src="img/req.jpg" alt="required"></label>
   <input type="text" name="zipcode" id="zipcode" value="" />
</div>

<fieldset><legend>1. What kind of group/company do you have? <img src="img/req.jpg" alt="required"></legend>
   <span id="nfpfp" class="InputGroup">
       <label><input name="nfpfp" id="nfpfp_1" type="radio" value="1" />For-profit business.</label>
       <label><input name="nfpfp" id="nfpfp_2" type="radio" value="2" />Non-profit 501(c)3 organization.</label>
   </span>    
</fieldset>

<fieldset><legend>2. How will you use the booth space? Select all that apply. <img src="img/req.jpg" alt="required"></legend>
   <span id="type" class="InputGroup">
       <label><input name="food" id="type_1" type="checkbox" value="1" />Food sales</label>
       <label><input name="retail" id="type_2" type="checkbox" value="2" />Retail sales</label>
       <label><input name="activity" id="type_3" type="checkbox" value="3" />Activity</label>
       <label><input name="display" id="type_4" type="checkbox" value="4" />Display</label>
       <label><input name="other" id="type_5" type="checkbox" value="5" />Other</label>
   </span>    
</fieldset>

<label for="otherdetails" class="newcol offsides">Enter a short description of your use. (Ex: "BBQ sandwiches", "kite kits", "face painting".) <img src="img/req.jpg" alt="required"></label> 
   <input type="text" name="otherdetails" id="otherdetails" value="" />



<fieldset><legend>3. Select any/all that apply. Additional questions may appear, if further information is required.</legend>
   <span id="additional" class="InputGroup">
       <label><input name="raffle" id="raffle_1" type="checkbox" class="switchcheck1" value="1" />I'll be selling raffle tickets and/or holding a raffle at the festival.</label>
           <div class="newcol offstate1">
           <label for="raffledetails">You'll need written permission from the Exchange Club. Please enter details about the raffle. <img src="img/req.jpg" alt="required"></label>
               <textarea name="raffledetails" id="raffledetails" tabindex="<?php echo $tabin; $tabin++; ?>"></textarea>
           </div>

       <label><input name="trailer" type="checkbox" id="trailer_1" value="1">I'll be bringing a trailer.</label>
       <label><input name="outlets" type="checkbox" id="outlets_1" class="switchcheck2" value="1" />I'll require electrical outlets.</label>
           <div class="newcol offstate2">
           <label for="outletsdetails">How many outlets will you require? <img src="img/req.jpg" alt="required"></label>
               <input type="text" name="outletsdetails" id="outletsdetails" />
           </div>
       </span>    
</fieldset>



<input type="button" name="submit" class="a_button" value="submit" />

</form>

2 个答案:

答案 0 :(得分:3)

name="submit"的元素类型为button,而不是submit,因此它会呈现一个无效的普通按钮(意图将一些JavaScript绑定到它上面)。< / p>

改为使用type="submit"

答案 1 :(得分:0)

尝试

<input type="submit" name="submit" class="a_button" value="submit" />

提交按钮。