Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 5th, 2000, 11:10 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old July 6th, 2000, 01:47 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

"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..."

Reply With Quote
  #3  
Old July 6th, 2000, 03:03 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #4  
Old July 6th, 2000, 04:45 AM
herou herou is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: germany
Posts: 119 herou User rank is Corporal (100 - 500 Reputation Level)herou User rank is Corporal (100 - 500 Reputation Level)herou User rank is Corporal (100 - 500 Reputation Level)herou User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 23 m 13 sec
Reputation Power: 12
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: <A HREF="http://www.yoursite.com/thankyou.htmnn";" TARGET=_blank>http://www.yoursite.com/thankyou.htmnn";</A>

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

Reply With Quote
  #5  
Old July 6th, 2000, 05:57 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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: <A HREF="http://www.yoursite.com/thankyou.htmnn";" TARGET=_blank>http://www.yoursite.com/thankyou.htmnn";</A>


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).]

Reply With Quote
  #6  
Old July 6th, 2000, 12:13 PM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > serious Problem with one Click!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway