Re: How to avoid submitting twice?

From: Date: Thu, 18 Jan 2001 20:40:46 +0000
Subject: Re: How to avoid submitting twice?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35436@lists.php.net to get a copy of this message
1: register a ver in the session or 2: register the event in the DB -a -- Alex Black, Head Monkey enigma@turingstudio.com The Turing Studio, Inc. http://www.turingstudio.com vox+510.666.0074 fax+510.666.0093 Saul Zaentz Film Center 2600 Tenth St Suite 433 Berkeley, CA 94710-2522 > From: san_kalyan@yahoo.com (Chakravarthy K Sannedhi) > Newsgroups: php.general > Date: 17 Jan 2001 13:11:20 -0800 > Subject: [PHP] How to avoid submitting twice? > > hello all, > > I am having a form which contains a dropdown listbox > and a submit button. The user will choose any number > from 1 to 5 and hits the submit button. After this the > data that he had selected (1,2,3,4 or 5) enters into a > mysql database(this data enters into the row with the > latest userid) and a link appears, so that by click > that link he can go to next page. > I want to avoid the user from submitting his opinion > once again if he does it already. > Here is the code that i have wrote, which is going > logically some where wrong. > FYI : opinion and submit are the names of the dropdown > listbox and submit buttons. scene1 is the name of the > field in the table named testtable into which the data > enters(one of 1 to 5) > > mysql_connect ('localhost','myname','password') or die > ('<b>unable to connect to the database.</b>'); > mysql_select_db ('usertest') or die ('<b>unable to > select the database.</b>'); > > if ($submit) { > $result = mysql_query("select * from testtable order > by userid desc limit 1"); > $myrow = mysql_fetch_array ($result); > $id = $myrow["userid"]; > $query = "update testtable set scene1='$opinion' where > userid=$id"; > mysql_query ($query); > echo "<a href=next.php>Go to next page</a>"; > /* this is the part i am trying to use to avoid him > from doing submission second time */ > $result=mysql_query("select * from testtable order by > userid desc limit 1"); > $myrow = mysql_fetch_array ($result); > $scene1 = $myrow["scene1"]; > if ($scene1 == 1||2||3||4||5) { > echo "<script language=\"javascript\">"; > echo "alert(\"You can choose the rating only > once\");"; > echo "</script>"; > } > } > > Thanks > Chakravarthy K Sannedhi > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#35436) next »