选择一种形式的单选按钮后,显示另一种形式,并在提交后返回

时间:2018-08-22 08:35:43

标签: javascript php html css

提交后,它应该显示相同的选定表单

一切正常,问题在于提交表单后,它清除了整个页面,我们必须再次选择单选按钮,我不希望这样,我需要刷新后将其保留在同一页面上表单,因为单选按钮是一种形式,产品详细信息是另一种形式。

<div id="myTabContent" class="tab-content fancyTabContent" aria-live="polite">
  <div class="tab-pane  fade active in" id="tabBody0" role="tabpanel" aria-labelledby="tab0" aria-hidden="false" tabindex="0">

    <div>
      <div class="row">

        <div class="col-md-12">

          <div align="center" style="background-color:#B4B4B4;color:white;font-size:20px;height:5%">
            <form action=" " method="POST">
              <label>
        <input value="credit" type="radio" name="formselector" onclick="displayForm(this)" <?php if (isset($_POST['formselector']) && $_POST['formselector']=="credit") echo "checked";?> >Credit</label>&nbsp;&nbsp;&nbsp;&nbsp;

              <label><input value="debit" type="radio" name="formselector" onclick="displayForm(this)"  <?php if (isset($_POST['formselector']) && $_POST['formselector']=="debit") echo "checked";?> >Debit</label></form>
          </div>

          <div style="display:none; position:relative" id="credit">
            <form class="well form-horizontal" action=" " method="POST" id="credit_form">
              <fieldset>
                <!--THIS IS THE FORM-->
                <div class="form-group">
                  <label class="col-md-4 control-label"></label>
                  <div class="col-md-4">
                    <button type="submit" class="btn btn-warning" name="CREDITSUBMIT" value="CREDITSUBMIT">SUBMIT <span class="glyphicon glyphicon-send"></span> 
       </button>
                  </div>
                </div>

PHP:

if(isset($_POST['CREDITSUBMIT'])) { $POINSERT1 = mysql_query("INSERT INTO CREDIT_PO (PO_NUM,PO_DATE,COMPANY,MATERIAL_QUANTITY,TOTAL_AMOUNT,ADVANCE_AMOUNT,REM_BAL_AMOUNT,EXP_DATE,PLACE_OF_DELIVERY,CUST_NAME,ISSUED_BY,STATUS) VALUES ('$_POST[PO_NUM]','$_POST[PO_DATE]','$_POST[COMPANY]','$_POST[MATERIAL_QUANTITY]','$_POST[TOTAL_AMOUNT]','$_POST[ADVANCE_AMOUNT]','$_POST[REM_BAL_AMOUNT]','$_POST[EXP_DATE]','$_POST[PLACE_OF_DELIVERY]','$_POST[CUST_NAME]','$_POST[ISSUED_BY]','$_POST[STATUS]')");
echo "INSERTED SUCCESSFULLY ";}

0 个答案:

没有答案