YouTube Icon

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>

Also Read:- PayPal Standard Payment Gateway Integration in PHP



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.

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

Our mission is "Har Koi Dekhe Video, Har Ghar Dekhe Video, Ghar Ghar Dekhe Video" so we Provide videos related to Tutorials, Travel, Technology, Wedding, Cooking, Dance, Festivals, Celebration.

Apna Video Wala
CFT

News & Blogs

dd45018a5d41c7bd2cf3c933682543d7.png

4 PHP Project Topics List to Ignite Your Web De...

Welcome to this article where we delve into 4 captivating PHP project topics. Whether you're ...

f8e796b5e98fda922e6c527e83a272c8.png

Top 10 PHP Frameworks Developers Must Use

PHP has been the most popular web development platform for over 20 times. Launched in 1995, PHP m...

1a1a2e0ce38eef1714546c1d322f1e08.png

Top 8 PHP Frameworks for 2022

Assuming you're a business person, odds are great that you must think of your own web applica...

Top Authors

Lamia Rochdi is the Marketing Manager at Bell Flavors & Fragrances EMEA. A successful family-...

Lamia Rochdi

I’m Mertin Wilson a technician in a camera company and certified expert of different P...

Mertin Wilson

Zakariya has recently joined the PakWheels team as a Content Marketing Executive, shortly after g...

Zakariya Usman

Pankaj Singh is a Senior Digital Marketing Consultant with more than 2 years of experience in SEO...

Pankaj Singh
CFT

Our Client Says

WhatsApp Chat with Our Support Team