表单操作不适用于我的代码段

时间:2017-05-05 22:17:57

标签: javascript php html

我的表单中有多个提交按钮,所有按钮都有不同的功能,但在填写完所有文本框后,我的最终提交表单不会重定向到操作页面。

我检查了所有可能性,但一切都很好。我不知道我哪里出错了。请帮我。提前谢谢。

<script type="text/javascript" src="js/custom.js"></script>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body">
        <section>
          <div class="wizard">
            <div class="wizard-inner">
              <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active">
                  <a href="#step6" data-toggle="tab" aria-controls="step6" role="tab" title="Step 6">
                    <span class="round-tab">
															<i class="glyphicon glyphicon-folder-open"></i>
														</span>
                  </a>
                </li>
                <li role="presentation" class="disabled">
                  <a href="#step7" data-toggle="tab" aria-controls="step7" role="tab" title="Step 7">
                    <span class="round-tab">
															<i class="glyphicon glyphicon-pencil"></i>
														</span>
                  </a>
                </li>
                <li role="presentation" class="disabled">
                  <a href="#step8" data-toggle="tab" aria-controls="step8" role="tab" title="Step 8">
                    <span class="round-tab">
															<i class="glyphicon glyphicon-picture"></i>
														</span>
                  </a>
                </li>

              </ul>
            </div>
            <form action="models/confirm.php" method="post" enctype="multipart/form-data">
              <div class="tab-content">
                <div class="tab-pane active" role="tabpanel" id="step6">
                  <div class="mobile-grids">
                    <div class="mobile-left text-center">
                      <img src="images/dth.png" alt="" />
                    </div>
                    <div class="mobile-right ">
                      <h4>Pay your DTH bill. Which operator?</h4>
                      <div class="section_room">
                        <select class="frm-field required" id="opr_dth_code" name="opr_code" onchange="opr_dth_check();">
																	<option value="">Select DTH Operator</option>
																	<?php 
																		include("models/db-settings.php");
																		$oprcmd = mysql_query("SELECT opr_name,opr_code FROM operator where opr_type='DTH'");
																		while($retopr = mysql_fetch_array($oprcmd))
																		{
																		?>
																		<option value="<?php echo $retopr["opr_code"]; ?>"><?php echo $retopr["opr_name"]; ?></option>
																		<?php 
																		}
																		?>
																</select>
                      </div>
                    </div>
                  </div>
                  <ul class="list-inline pull-right">
                    <li><button type="button" id="opr_dth_button" disabled class="mob-btn btn btn-primary next-step">Next</button></li>
                  </ul>
                </div>
                <div class="tab-pane" role="tabpanel" id="step7">
                  <div class="mobile-grids">
                    <div class="mobile-left text-center">
                      <img src="images/dth.png" alt="" />
                    </div>
                    <div class="mobile-right">
                      <h4>What's your DTH Number?</h4>
                      <div class="dth-rchge">
                        <input type="text" name="req_number" id="req_dth_number" data-type="num" maxlength="11" onkeypress='return event.charCode >= 48 && event.charCode <= 57' onkeyup="dth_check();" required="">
                      </div>
                    </div>
                  </div>
                  <ul class="list-inline pull-right">
                    <li><button type="button" class="mob-btn btn btn-default prev-step">Previous</button></li>
                    <li><button type="button" id="dth_submit" disabled class="mob-btn btn btn-primary next-step">Next</button></li>
                  </ul>
                </div>
                <div class="tab-pane" role="tabpanel" id="step8">
                  <div class="mobile-grids">
                    <div class="mobile-left text-center">
                      <img src="images/dth.png" alt="" />
                    </div>
                    <div class="mobile-right ">
                      <h4>How Much To Recharge?</h4>
                      <div class="dth-rchge">
                        <input type="text" name="req_amount" id="req_dth_amount" placeholder="Amount" required="" onkeyup="dth_amount_chck();">
                      </div>
                    </div>
                  </div>
                  <ul class="list-inline pull-right">
                    <li><button type="button" class="mob-btn btn btn-default prev-step">Previous</button></li>
                    <li><button type="button" id="dth_amount_submit" class="mob-btn btn btn-primary btn-info-full">Make Payment</button></li>
                  </ul>
                </div>
                <div class="clearfix"></div>
              </div>
            </form>
          </div>
        </section>
      </div>
    </div>
  </div>
</div>

2 个答案:

答案 0 :(得分:0)

简单地将脚本放在正文中的最后一个元素。原因是因为脚本的当前位置使得大多数项目在主体中为null或未定义。这是因为您的脚本肯定包含直接归因于页面内容的代码。

答案 1 :(得分:0)

我假设你的另外两个php文件与header.php文件不在同一个文件夹中。

如果是,请为脚本使用相同的include,如果不使用不同的脚本路径。否则,如果它们位于其他文件夹下,则使用此<script type="text/javascript" src="../js/custom.js"></script>

包含custom.js