forms - PHP Stopping a person pressing Submit multiple times -


i have below form, , after form php requests curl can take while. because of keep pressing submit button thinking nothing has happened. causes multiple entries in database. me , let me know put in stop this.

i tried javascript solution in first answer stopped php script followed. not wanted. sorry

<!doctype html> <html> <head>          <meta charset="utf-8">         <link href="css2/style.css" rel='stylesheet' type='text/css' />         <meta name="viewport" content="width=device-width, initial-scale=1">         <script type="application/x-javascript"> addeventlistener("load", function() { settimeout(hideurlbar, 0); }, false); function hideurlbar(){ window.scrollto(0,1); } </script>         <!--webfonts-->         <link href='//fonts.googleapis.com/css?family=open+sans:400,300,600,700,800' rel='stylesheet' type='text.css'/>         <!--//webfonts-->          <center><img class="displayed" src="images/logo.jpg" alt="logo" style="width:128px;height:128px;"></center>  </head>  <body>     <div class="main">         <form action="" method="post" enctype="multipart/form-data" id="contactform" >       <input type="hidden" name="action" value="submit">             <h1><span>sign up</span> <lable> brook on sneydes</lable> </h1>             <div class="inset">                 <p>             <center><label ><?php echo $text; ?></label></center>                          <label for="first">first name</label>                     <input type="text" name="first" id="first" value="" placeholder="" required/>                 </p>                 <p>                         <label for="last">surname</label>                     <input type="text" name="last" id="last" value="" placeholder="" required/>                 </p>          <p>           <label for="mobile">mobile number</label>           <input type="text" name="mobile" id="mobile" value="" placeholder="" required/>       </p>         <p>           <label for="email">email address</label>           <input type="text" name="email" id="email" value="" placeholder="" required/>         </p>          </div>                <p class="p-container">                 <input type="submit" name="submit" id="submit" value="submit">                 </p>         </form>     </div>             <!-----start-copyright---->                     <div class="copy-right">                         <p> &copy; 2016 <a href="http://spearheaddigital.com.au/">spearhead digital</a>. rights reserved.</p>                     </div>                 <!-----//end-copyright----> </body> </html>  <?php if(isset($_post['submit']) && !empty($_post) ){  $first = $_post['first']; $last = $_post['last']; $mobile = $_post['mobile']; $email = $_post['email'];  // other code  } 

you can disable submit button when submitting form.

an example using jquery:

<script type="text/javascript">      $(document).ready(function() {         $('#contactform').submit(function() {             $('input[type=submit]', this).prop("disabled", true);         });     });  </script> 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -