* Thus wrote J J ([EMAIL PROTECTED]): > What is the simplest way to avoid duplicate order > entry on a form? Some people aren't patient enough to > wait for the SSL/credit card processing and will click > the submit button two, three, or more times causing > duplicate orders. > > Is there a quick way to disable the submit button at > least in javascript? Better yet, something quick and > easy that could be done server-side without a lot of > programming like cookies, database flags, etc? >
Here is a method to prevent user from hitting reload. yourform.php: <?php $valid_form = uniqid(mtrand()); $_SESSION['valid_form'] = $valid_form; ?> <input type="hidden" name="valid_form" value="<?php echo $valid_form?>"> Then the processing.php: <?php ingore_user_abort(1); $valid_form = $_SESSION['valid_form']; // get the validation $_SESSION['valid_form'] = ''; // clear validation if(empty($_GET['valid_form']) || $valid_form != $_GET['valid_form']) { echo "I told you not to reload the damn thing"; exit; } // confirm order isn't already being processed... // ... // process order // ... ?> > I've thought of a few things (like hidden variables > with an order ID or cookies/flags) but this really > should be a quick fix since it's not a big problem on > the site. > > Thanks in advance for any tips or techniques! > > __________________________________ > Do you Yahoo!? > Free Pop-Up Blocker - Get it now > http://companion.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php