Results 1 to 3 of 3

Thread: prob in submit a form

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default prob in submit a form

    hi... i am using a form to feed back some data in my web page.... when use enters data and submits form, the data gets submitted and stored into databse and the page redirected to the page that is specified in the "action"..

    -----
    but when a usr refresh the page page sves the "resend" option and again submits the data into database... it feeds tha data as many times as usr refresh the page...
    ----
    i want that data to be inserted once only intodatabe... so i need any special coding to stop it...? plz help me by giving ur valueable suggestion...

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Yes, you can make a session to prevent them from refreshing the page. BUt you'd need to post code here so that we can specifically help you. Other than that, we can only point you in the right direction.
    - Josh

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    You should avoid using session to hold information about the state of your website when there is another solution. In this case the better solution is to use:
    PHP Code:
    header("Location: http://www.yoursite.com/");
    exit; 
    to redirect to another page after successful form submission.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •