Prevent user to use back button with warning or disable any insert

前端 未结 2 1088
-上瘾入骨i
-上瘾入骨i 2020-12-20 10:25

I have a form in page1.php which directs to page2.php from where the data from the form in page1.php is inserted into database. after

2条回答
  •  轮回少年
    2020-12-20 10:36

    Instead of giving link to a third page, redirect to the very same URI
    this is quite handy method called POST/Redirect/GET:
    here is a concise example of it:

     $val) {
          $form[$key] = htmlspecialchars($val);
        }
      }
    } else {
      $form['name'] = $form['comments'] = '';  
    }
    include 'form.tpl.php';
    ?>  
    

    Here you can see another example, concise yet powerful: Separating Logic/Style in PHP properly
    it's complete solution to display, add and edit database contents, exactly for admin purpose.

提交回复
热议问题