开发者

how to stop refreshing page in php [duplicate]

This question already has answers here: How to prevent form resubmission when page is refreshed (F5 / CTRL+R) (21 answers) Closed 1 year ago.
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


You want the POST / Redirect / GET pattern.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜