我在創建腳本時遇到問題。我有一個index.php文件,它控制所有其他頁面。雖然,我在使用$ _GET ['']和$ _POST ['']變量在頁面中遇到問題。頁面多頁式PHP - 問題
我有一個網頁,名爲adpanel.php該頁面中,我使用$ _GET函數是這樣的:
if($_GET['newad'] == "create"):
//In this, I only want the content showed when the above statement is true.
endif;
上面的代碼,確實工作。我知道如何顯示內容,如果$ _GET是真的。儘管在$ _GET中我有一個$ _POST函數,它將通過jquery提交,並將數據返回到adpanel.php頁面。
我有一個問題,它返回狀態div中的整個頁面。例如: http://awesomescreenshot.com/0f8i95ba0
下面是我的指標,控制頁面:
case 'a': // Advertisement Panel
if($_GET['newad']){
if($_POST){
include($settings['pagepath'].'adpanel.php&newad=create');
}
include($settings['pagepath'].'adpanel.php&newad=create');
}
if($_GET['manage']){
getHeader();
include($settings['pagepath'].'manageAds.php');
getFooter();
}else{
getHeader();
include($settings['pagepath'].'adpanel.php');
getFooter();
break;
}
我該如何解決這個問題?
嘗試使用[$ _REQUEST(http://php.net/manual/en/reserved.variables.request.php)。您可以在不知道實際使用哪一個的情況下同時處理POST/GET。不知道這是否能解決你的問題。 –