Search code examples
phpreload

how to stop refreshing page in php


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


Solution

  • You want the POST / Redirect / GET pattern.

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