How to Disable Submit Button After Form Submission in PHP?




How to Disable Submit Button After Form Submission in PHP?

I will help you for how to disable submit button after click in jquery php. we can prevent double click submit button in jquery html. it will help you to disable submit button after click in php, laravel, codeigniter etc project that use jquery.

Sometime, we have to prevent too many clicks on submit button. if you are working on register form with php then it might be take time to submit form because of long processes of submit page. But if user have server issue or Internet issue etc then he will just click again and again. So may it can create problem form us. so basically you must prevent it by using disabled submit button after one click using jquery.

Also Read:- How to Add Spell Checker In Your Webpage Using jQuery

Here bellow simple example will help you to resolved your problem by using bellow example. You can see full example so it can help you in your php project.

<!DOCTYPE html>
<html>
   <head>
      <title>How to Disable Submit Button After Form Submission in PHP?</title>
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
   </head>
   <body>
      <form action="/post.php" method="POST" id="my-form">
         <input type="text" name="name">
         <input type="text" name="email">
         <button type="submit" id="btn-submit">Submit</button>
      </form>
      <script type="text/javascript">
         $(document).ready(function () {
         
             $("#my-form").submit(function (e) {
                 $("#btn-submit").attr("disabled", true);
                 return true;
         
             });
         });
         
      </script>
   </body>
</html>

 



Author Biography.

Lokesh Gupta
Lokesh Gupta

Overall 3+ years of experience as a Full Stack Developer with a demonstrated history of working in the information technology and services industry. I enjoy solving complex problems within budget and deadlines putting my skills on PHP, MySQL, Python, Codeigniter, Yii2, Laravel, AngularJS, ReactJS, NodeJS to best use. Through Knowledge of UML & visual modeling, application architecture design & business process modeling. Successfully delivered various projects, based on different technologies across the globe.

Join Our Newsletter.

Subscribe to CrowdforThink newsletter to get daily update directly deliver into your inbox.

CrowdforJobs is an advanced hiring platform based on artificial intelligence, enabling recruiters to hire top talent effortlessly.

CrowdforJobs

CrowdforApps brings to you the well researched list of the most successful and finest App development companies, Web software developers.

CrowdforApps

CrowdforGeeks is where lifelong learners come to learn the skills they need, to land the jobs they want, to build the lives they deserve.

CrowdforGeeks

CrowdforThink is a leading Indian media and information platform, known for its end-to-end coverage of the Indian startup ecosystem.

CrowdforThink
CFT

News & Blogs

7a7daa743d93a744b4fd5748a8389281.jpg

Best PHP Frameworks To Use In 2019’s CMS Websit...

PHP is a widely used language for web design and development all over the world. Almost 83% of we...

7f219b78165ca3de8e1b5d68c5ed0834.jpg

Create a Simple CRUD Database App - Connecting ...

What is CRUD In computer programming, create, read, update, and delete are the four basic functi...

464bc819f41b6878fc27398415288c37.jpg

How to Use Web Scraping

Have you ever thought about web scrapping? What's the main benefit of it? How do you start us...

Top Authors

Hey, I am Suraj - a full-time blogger and a social media expert currently working on the Growth H...

Suraj Kumar

With good communication and writing skiils, Astha Sharma is a full-time content writer working wi...

Astha Sharma

Overall 3+ years of experience as a Full Stack Developer with a demonstrated history of working i...

Lokesh Gupta

Aditya Sehgal is a recognised financial adviser, tech and gadget writer and blogger. Still he has...

Aditya Sehgal
CFT

Our Client Says

WhatsApp Chat with Our Support Team