2014-01-20 126 views
0

我有一個頁面,在form.php文件中有一個登錄表單,當我按下ok時,它會調用文件post_form.php來檢查插入的數據。如果數據正常,我必須自動打開文件confirm.php,我該怎麼做?php - 從一個頁面重定向到另一個

+0

如果我直接調用confirm.php會發生什麼? – Alexander

回答

2

您可以使用PHP的header()函數。 但請確保在header()呼叫之前沒有任何輸出,否則將失敗。

if(HERE YOUR CONDITION) { 
    header("Location: confirm.php"); 
} 
0
ob_clear(); //Make sure you've done ob_start() or not output anything to the browser  
header('Location: confirm.php'); 
exit; 
0

put header(「Location:confirm.php」);在你的條件。

相關問題