how to stop data automatically insert into database in php

后端 未结 2 1896
一生所求
一生所求 2021-01-27 05:14

I have problem in this code. In this code when i press save data button , the data insert into database but when i refresh page then it\'s automatically insert into database, wh

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 06:02

    Make a separate php file that will insert data to database. Give this in the form action attribute.

    ...... ......

    insert.php file

    
    

    You can use header() to redirect to your previous page if you want. Thus not allowing the refreshing of insert.php

    header("location: your_page.php");
    

    it will be safe if you use Prepared Statements Take a look

提交回复
热议问题