|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
"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..." |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
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).] |
|
#6
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > serious Problem with one Click! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|