★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum6/HTML/000246.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  Perl
  serious Problem with one Click!

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   serious Problem with one Click!
chinnavi
Member
posted July 05, 2000 10:10 AM     Click Here to See the Profile for chinnavi   Click Here to Email chinnavi     Edit/Delete Message Reply w/Quote
I face serious problem with MySQL and PERL DBI ...
The Thing is i have one button in my form
that calls one CGI ..
The CGI will do the function that will insert the values of the form into a Table.
"The Serious Problem" is this function inserts again and again when i click "Reset" button ...
i startled when i see the table values ...that i inserted twice

anybody having idea ?


vijay

Shiju Rajan
Member
posted July 06, 2000 12:47 AM     Click Here to See the Profile for Shiju Rajan   Click Here to Email Shiju Rajan     Edit/Delete Message Reply w/Quote

"The Serious Problem" is this function inserts again and again when i click "Reset" button ...

make sure that your reset button is not..
<input type="submit" value="Reset">

it should be:
<input type="reset" value="Reset">
--


------------------
SR -
webshiju.com

"The fear of the LORD is the beginning of knowledge..."

chinnavi
Member
posted July 06, 2000 02:03 AM     Click Here to See the Profile for chinnavi   Click Here to Email chinnavi     Edit/Delete Message Reply w/Quote
Sorry !

If i press "Reload" button in the Browser The CGI program is executing again and inserting values into table again (in the MySQL DB)..

What should i do ?

vijay

herou
Junior Member
posted July 06, 2000 03:45 AM     Click Here to See the Profile for herou     Edit/Delete Message Reply w/Quote
You have to redirect to another page when the values have been inserted. Do not let your .cgi output any HTML code! In Detail: The only output of your .cgi, that really means the one and only use of the 'print' function must appear at the end of your script, namely a line like this:

print "Location: http://www.yoursite.com/thankyou.htm\n\n";

This promptly redirects the client to another page and he cannot mess up your database by hitting 'reload' any more.

Shiju Rajan
Member
posted July 06, 2000 04:57 AM     Click Here to See the Profile for Shiju Rajan   Click Here to Email Shiju Rajan     Edit/Delete Message Reply w/Quote
vijay,

you can tackle this problem..

i don't know wether you are receiving any unique value from form(user) to your database(ie, field like "username" --it will be unique for each and every user).so you can issue a select command before inserting new record into the database.


"select * from tablename username='$username'";

if that record is exist then show him a message "Record is already exising in the database"...


print "Location: http://www.yoursite.com/thankyou.htm\n\n";


you can implement this logic also.but here also you can update your data if you go back to your previuos screen and update it again...

-----


------------------
SR -
webshiju.com

"The fear of the LORD is the beginning of knowledge..."

[This message has been edited by Shiju Rajan (edited July 06, 2000).]

chinnavi
Member
posted July 06, 2000 11:13 AM     Click Here to See the Profile for chinnavi   Click Here to Email chinnavi     Edit/Delete Message Reply w/Quote

Thank you ,
"Checking the form values before inserting" is very good idea.
But what about redirecting a page another Location will work...
Actually I want to insert into table before proceeding to another page ...This also seems to be a good idea.Because it will reload from that page alone....
I am now working on validating the user inputs before inserting into table along with redirecting to another page ...
There is still one more thing is there to thing ... I tested the Back button and it displays all the Form values ..
Now if User submits ... The data will be inserted into table..
This Problem is still there in Devshed.
See my Double Submission in MySQL Forum ...
B'cause sometime internet speed become slow ...


thanks for your golden Help!

vijay

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.