#1
  1. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    "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..."
  4. #3
  5. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    germany
    Posts
    122
    Rep Power
    18
    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.
  8. #5
  9. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    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).]
  10. #6
  11. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    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

IMN logo majestic logo threadwatch logo seochat tools logo