Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    19

    Unanswered: prevent resubmission of form

    PHP Code:

                    $site_title
    =$_POST['sitetitle'];
            
    $site_slogan=$_POST['siteslogan'];
            
    $site_address=$_POST['siteaddress'];
            
                    if (empty(
    $site_title) && empty($site_address) ){
            echo 
    "Site Title or Site Address Can't be Empty";
            
    $set_key=0;
            }
            else{
            
    $set_key=1;        }
            
    // Inserting this information in Database
            
            
    $query_setting="INSERT INTO settings ".
            
    "(site_title,site_tagline,site_address) ".
            
    "VALUES ('$site_title','$site_slogan','$site_address')";
            
            
    // if all the things works fine then query will execute.
                   
                    
    if ($set_key==1){
            
    $set_query=mysql_query($query_setting);
            echo 
    "Settings Saved";
            echo 
    "<br>";
            echo 
    "Press Finish";
            echo 
    "";
            }
            else{

            } 
    all the thing works fine but i want
    when page refresh it destroy the past values please help me to avoid resubmission using refresh.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Separate this code in to a separate PHP file that performs a redirect back to the calling page.
    George
    Home | Blog

Posting Permissions

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