Results 1 to 4 of 4

Thread: need help in submitting form data

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

    Default need help in submitting form data

    hi,
    i have a bloging form. when a user enter his blog into textbox and submit it the goes to the server and saved on server database and goes to another page, u can say the page is (showBlog.php)...


    but my problem is this if a user presses refresh button, the data is again submitted and fed into database...

    data fed as many times as user presses refresh button...


    plz suggest me how to prevent this data to b fed twice in database...

    THanks in advanced

  2. #2
    Join Date
    Nov 2008
    Posts
    58
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Default

    1. After successful processing, redirect the user to a thanks page rather than displaying a message from the form processor.
    In PHP, for example:
    header( "Location: $thankyouurl" );

    2. Validate the submission based one some unique field (like the email address)

  3. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Have it all on one page. Use isset

    PHP Code:
    if (isset($_POST['something')) {
    //check inputs then process form then display thanks page code.
    } else {

    For a more detailed answer post code.

    http://php.net/manual/en/function.isset.php

    Oh this was a javascript post... nevermind then unless you can use php..
    Corrections to my coding/thoughts welcome.

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

    Default

    dear, i already had used isset() function in PHP...


    but the problem is this, after submitting form , when i press refresh button, a alertbox comes and asks
    this page cannot be refreshed without resending the informationclick retry to resend the information
    when i click on retry it submits the data again (duplicates the data in database)
    when i click on cancel button it shows a error page " that page cannot be displayed"

    the main thing what i want is to cancel the refresh action

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
  •