Hi: I have this script running pretty well accept for the fact that I need to click submit TWICE for it to continue. Can someone help me so that I only have to click it once to continue. Thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1251"> <style> .errText { font-family: Arial; font-size: 10px; color: #CC0000; text-decoration: none; font-weight: normal; } </style> <title>Verification !!!</title> </head> <?php $errFName = ""; $errMName = ""; $errLName = ""; $frmCounter = 0; if($_POST["ac"]=="login") { // If First Name is NOT letters, dash or spaces then display error message. if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["fname"]) === 0) $errFName = '<class="errText">First name must be from letters, dashes, spaces and must not start with dash'; else $frmCounter = $frmCounter + 1; // Add validation & Santization here // If Middle Name is NOT letters, dash and spaces then display error message. if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["mname"]) === 0) $errMName = '<class="errText">Middle name must be from letters, dashes, spaces and must not start with dash'; else $frmCounter = $frmCounter + 1; // Add validation & Santization here // If Middle Name is NOT letters, dash and spaces then display error message. if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["lname"]) === 0) $errLName = '<class="errText">Last name must be from letters, dashes, spaces and must not start with dash'; else $frmCounter = $frmCounter + 1; // Add validation & Santization here // if ($frmCounter == 3) { $frmSubmit = "connecter.php"; } else { $frmSubmit = $_SERVER['$PHP_SELF']; } } ?> <body> <form name="main" action="<?php echo $frmSubmit; ?>" method="POST"> <input type="hidden" name="ac" value="login"> <table border="1" width="100%"> <tr> <td width="124"> </td> <td width="278"> </td> <td> </td> </tr> <tr> <td width="124" bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#3366FF"> First Name:</font></b></td> <td bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#FF0000"> </font></b> <input name="fname" style="Width: 262; height:22" maxLength="15" size="2" value="<?php echo $_POST['fname']; ?>" ></td> <td> <?php if(isset($errFName)) echo $errFName; ?></td> </tr> <tr> <td width="124" bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#3366FF"> Middle Name:</font></b></td> <td bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#FF0000"> </font></b> <input name="mname" style="Width: 98; height:22" maxLength="15" size="2" value="<?php echo $_POST['mname']; ?>" ></td> <td> <?php if(isset($errMName)) echo $errMName; ?></td> </tr> <tr> <td width="124" bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#3366FF"> Last Name:</font></b></td> <td bgcolor="#FFFFFF"> <b><font size="2" face="Arial" color="#FF0000"> </font></b> <input name="lname" style="Width: 98; height:22" maxLength="25" size="2" value="<?php echo $_POST["lname"]; ?>" ></td> <td> <?php if(isset($errLName)) echo $errLName; ?></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </body> </html>
may be you can use javascript confirm box to proceed with the request or not fyi the confirm box returns true or false.
oh sorry.. i thought you are talking about the possible spams. yep.. why not use confirm box. or instead of type="submit" replace it with onDoubleClick="submit the form function"