help in php

Discussion in 'PHP' started by mahiraj, Nov 16, 2007.

  1. #1
    Hi All,

    I am inserting values into the database through a form.
    when I am pressing 'reload' button the values are again inserting in-to the database i do not want to do this please tell me what to do????

    thanks
     
    mahiraj, Nov 16, 2007 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    It is default behavior. By refreshing the page you are submitting the form again so After inserting values into db add a redirect on the page and show welcome message on third page or use querystring to show success message on same page

    Suppose you are inserting form values in db in save.php
    $result = mysql_query($query);
    header("Location: save.php?success=y"); // on the same page track if $success is equal to 'y' than show success msg.
    PHP:
    or redirect to a separate success screen page

    header("Location: success_msg.php");
    PHP:
     
    greatlogix, Nov 16, 2007 IP