-2

before submit the form text filed will be editable after submit the form it will be non-editable?

<div class="container">
  <form method="POST" name="requests" id="signup">
    <input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" >
    <button type="submit" value='Submit'  class="sendButton" name="submit" id='submitme'>Submit</button>
  </form>
</div>
Anshureddy
  • 15
  • 6
  • 4
    Set the `readonly` property to true in the form's `submit` event handler. If you want more specific help, please add the code you've attempted yourself to the question – Rory McCrossan Oct 22 '18 at 12:20
  • 4
    Possible duplicate of [How do I make a text input non-editable?](https://stackoverflow.com/questions/3676127/how-do-i-make-a-text-input-non-editable) – Dave Oct 22 '18 at 12:21
  • thanks for reply but input filed before is editable after submit the form when it is non editable. – Anshureddy Oct 22 '18 at 12:25
  • @bhavani, before asking question you can search first in the stackoverflow, so that you will get more related answers, that you will get more beneficial. – Kaif Khan Oct 22 '18 at 12:26
  • Possible duplicate of [HTML form readonly SELECT tag/input](https://stackoverflow.com/questions/368813/html-form-readonly-select-tag-input) – Nikola Lukic Oct 22 '18 at 13:07

2 Answers2

-1

Just use readonly.

<div class="container">
  <form method="POST" name="requests" id="signup">
    <input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" <?php echo isset($_POST['txtTitle']) ? "readonly" : "" ?> >
    <button type="submit" value='Submit'  class="sendButton" name="submit" id='submitme'>Submit</button>
  </form>
</div>
ringunger
  • 89
  • 6
-1

Try this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <form method="POST" name="requests" id="signup">
  <input type="hidden" value="yes" name="send">
    <input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" <?php echo isset($_POST['txtTitle']) ? "readonly" : "" ?> >
    <button type="submit" value='Submit'  class="sendButton" name="submit" id='submitme'>Submit</button>
  </form>
</div>

<script type="application/javascript">
$(document).ready(function(){
 <?
 //
 echo "var send='". $_POST['send']."';";
 ?>
 if(send=="yes"){
 $('#txtTitle').attr('disabled','disabled');
 };


});

</script>
Paweł Miłosz
  • 109
  • 1
  • 7
  • I added hiden input to your form. When user submit form, afther reload page script check if value of hidden fild is qual to "yes" then disabled or no txtTitle. – Paweł Miłosz Oct 22 '18 at 13:16