当点击弹出提交控件转到父表单提交为什么在PHP中

时间:2016-12-30 09:06:32

标签: javascript php jquery popup

当我点击"添加用户"在parent.php上链接,popup.php在新窗口中打开...我输入用户的详细信息并点击提交按钮。但是控制转到parent.php提交。无法从popup.php表单插入数据。 这是我的parent.php文件:

<script>
$(document).ready(function() {

  $("#clint").change(function() {
    if (document.getElementById("clint").value == "addclint") {
      $("#demo").trigger("click");
    }
  });
});
<script>

<div class="col-lg-6">
  <form name="f1" method="post" role="form" autocomplete="off" enctype="multipart/form-data" onSubmit="return valid();">
    <div class="form-group">
      <table>
        <tr>
          <td>
            <label>Enquiry Date</label</td>
              <td>
                <div class="form-group input-group">
                  <span class="input-group-addon"><i class="fa fa-calendar fa-1x"></i></span>
                  <input class="form-control" Placeholder="DD-MM-YYYY" name="Enq_Date" type="text" id="edate" onclick="up('errdt')">
                </div>
                <div id="errdt" style="font-size:14px;color:red"></div>
              </td>
        </tr>

        <tr>
          <td>
            <label>Description&nbsp;</label>
          </td>
          <td>
            <textarea class="form-control" rows="3" cols="5" name="Description"></textarea>
            <br/>
          </td>
        </tr>
        <tr>
          <td>
            <label>Souce of Enquiry</label>
          </td>
          <td>
            <input class="form-control" name="SrcOfEnq" id="sourenq" type="text" onclick="up('soe')">
            <div id="soe" style="font-size:14px; color:red"></div>
            <br/>
          </td>
        </tr>
        <tr>
          <td>
            <label>Client Name</label>
          </td>
          <td>
            <?php $csql="select client_name from client" ; $rces=m ysql_query($csql); echo '<select name="ClientName" id="clint" class="form-control" onclick=up("errclnt") > '; echo '<option></option>'; while($crnt=m ysql_fetch_array($rces)) { ?>
            <option value="<?php echo $crnt['client_name']; ?>">
              <?php echo strtoupper($crnt[ 'client_name']);} ?>
            </option>
            <option value="Not Applicable">Not Applicable</option>
            <option value="addclint" style="font-size:12px;color:#3399FF;font-family:Tahoma;">
              <_Add New_>
            </option>
            <?php echo '</select>'; ?>

            <br/>
          </td>
        </tr>

      </table>
    </div>
    <br/>
</div>
<center>
  <input type="submit" name="submit" class="btn btn-success btn-sm" value="Submit" />

</center>




<button class="btn btn-primary btn-xs" id="demo" data-toggle="modal" data-target="#abc">
  Client
</button>
<div class="modal fade" id="abc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Add New Supplier </h4>
      </div>
      <div class="modal-body">
        <?php include( 'AddSupplierForm.php'); ?>
      </div>

    </div>
  </div>
</div>


</div>
</div>
</form>

这是我的popup.php表单:

<form name="f1" method="post" role="form" id="newsup" onSubmit="" autocomplete="off" enctype="multipart/form-data">
  <table>
    <tr>
      <td>
        <br/>
        <label>Supplier Name</label>&nbsp;</td>
      <td>
        <input class="form-control" id="cnme" name="client_name" style="text-transform:uppercase;" type="text" autofocus onclick="up('cne')" />
        <div id="cne" style="font-size:14px; color:red"></div>
      </td>

      <td style="padding: 12px 12px 12px 12px;">
        <br/>
        <label>Address Line1</label>&nbsp;</td>
      <td>
        <input class="form-control" name="Address1" type="text" />
      </td>



    </tr>
    <tr>
      <td>
        <label>Address Line2</label>&nbsp;</td>
      <td>
        <input class="form-control" name="Address2" type="text" />
        </br>
      </td>

      <td style="padding: 12px 12px 12px 12px;">
        <label>Address Line3</label>&nbsp;
        <br/>
      </td>
      <td>
        <input class="form-control" name="Address3" type="text" />
        <br/>
      </td>
    </tr>

    <tr>
      <td>
        <label>Contact No</label><font size="2px" color="red">*</font>
      </td>
      <td>
        <input class="form-control" id="contact" maxlength="10" name="ContNum" type="text" onclick="up('mb')" />
        <div id="mb" style="font-size:14px;     color:red"></div>
        <br/>
      </td>

      <td style="padding: 12px 12px 12px 12px;">
        <label>FAX No</label>&nbsp;</td>
      <td>
        <input class="form-control" name="FaxNum" maxlength="10" type="text" />
        <br/>
      </td>
    </tr>
  </table>
  <br/>
  <br/>
  <center>
    <input type="submit" name="submit" class="btn btn-success btn-sm" value="Submit" />

  </center>


</form>

0 个答案:

没有答案