ItSolutionStuff.com

How to Disable Submit Button After Form Submission in PHP?

By Hardik Savani • May 14, 2024
PHP jQuery

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.

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.

Example:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable Submit Button After Form Submission in PHP? - ItSolutionStuff.com</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>

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Disable F5 Refresh Button using JQuery?

Read Now →

How to Disable Browser Back Button using JQuery?

Read Now →

JQuery Disable Right Click, Cut, Copy and Paste Example

Read Now →

PHP Dropzone Display Existing Files from Server Example

Read Now →

PHP MySQL Column Sorting Example Tutorial

Read Now →

PHP JQuery Chosen Ajax Autocomplete Example

Read Now →

PHP MongoDB CRUD Operation Example

Read Now →

PHP MySQL Login with Google Account Example

Read Now →

PHP MySQL DataTables Server-side Processing Example

Read Now →

PHP MySQL Contact US Form with Validation Example

Read Now →

How to Disable Right Click Menu using JQuery?

Read Now →

How to Get IP Address in JQuery?

Read Now →

Display Loading Image when AJAX Call is in Progress Example

Read Now →

How to use Google Maps API with JQuery PHP?

Read Now →