0
if(isset($_POST["subSubmit"])){
 if($_POST["subSubmit"]=="Send") {
  $sentto    = $_POST['txtSentto'];
  $sentcc    = $_POST['txtcc'];
 $sel="insert into newmessage set sendto='".$sentto."', 
                  sentcc='".$sentcc."'";
 $selqur=mysql_query($sel) or die("Error (" . mysql_errno() .")" . mysql_error());
 }
}

i am php beginner i dont know how to stop the reload page.For the above program not reload without submit button once submit button clicked data stored in database and then click refreshing the page the data automatically send to database.Plz give any ideas thank you

casablanca
  • 69,683
  • 7
  • 133
  • 150
Rajesh
  • 163
  • 4
  • 6
  • 12
  • Just a style note, instead of having two nested if statements you can use just one: if(isset($_POST["subSubmit"] && $_POST["subSubmit"]=="Send"). – jondro Nov 22 '10 at 08:31

1 Answers1

3

You want the POST / Redirect / GET pattern.

Also, sanitize your outside variables ($_POST) being used in your SQL.

alex
  • 479,566
  • 201
  • 878
  • 984