dpv21589 2017-03-10 15:03
浏览 78

提交和页面刷新后禁用提交按钮

What i want is pretty simple, i have a button that submits a value to my database once clicked, what i need is to diable the button parmanently after value has been submited, i have searched and the codes i have seen all enable the button when the page refreshes.. please can someone help me out?

My form and button code as follows:

<form action="<?php echo $editFormAction; ?>" method="POST" name="Status2" id="Status2" onSubmit="return confirm('Are you sure you want to submit?');">
      <input name="Confirm2" type="checkbox" id="Confirm2" value="Confirmed" checked="CHECKED" style="display:none;">
      <label for="Confirm2"></label>
      <input name="UpdateButton3" type="submit" class="art-button" id="UpdateButton3" value="Confirm"/>
      <input name="UserIDHiddenField4" type="hidden" id="UserIDHiddenField4" value="<?php echo $row_User['UserID']; ?>">
      <input name="Purge2" type="checkbox" id="Purge2" value="You Will Be Rematched Soon!" checked="CHECKED" style="display:none;">
      <label for="Purge2"></label>
      <input type="hidden" name="MM_update" value="Status2">
    </form>
  • 写回答

2条回答 默认 最新

  • douliao8402 2017-03-10 15:31
    关注

    First of all if you submit it, this has nothing to do with javascript. Save this in your database as @georoot says. Then when you submit, save a value in the database. If that value is set, you can disable the button by just HTML: <input type="submit" <?php if($valueFromDatabase==1){ ?> disabled <?php } ?> >

    评论

报告相同问题?