多页PHP-问题
我在创建脚本时遇到问题。我有一个index.php文件,它控制所有其他页面。但是,我在页面中使用带有$\u POST[]变量的$\u GET[]时遇到问题 我有一个页面,名为adpanel.php,在该页面中,我使用了$\u GET函数,如下所示:多页PHP-问题,php,jquery,variables,post,Php,Jquery,Variables,Post,我在创建脚本时遇到问题。我有一个index.php文件,它控制所有其他页面。但是,我在页面中使用带有$\u POST[]变量的$\u GET[]时遇到问题 我有一个页面,名为adpanel.php,在该页面中,我使用了$\u GET函数,如下所示: if($_GET['newad'] == "create"): //In this, I only want the content showed when the above statement is true. endif;
if($_GET['newad'] == "create"):
//In this, I only want the content showed when the above statement is true.
endif;
上面的代码确实有效。如果$GET为真,我知道如何显示内容。尽管如此,在$\u GET中我有一个$\u POST函数,它将通过jquery提交,并将数据返回到adpanel.php页面
我有一个问题,它返回status div中的完整页面。例如:
下面是我的索引,用于控制页面:
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;
}
如何解决此问题?尝试以下方法:
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;<--remove break
}
break; //<-- break after if/else so it breaks on case and does not continue
试用
if(isset($_GET['manage'])){
尝试使用。您可以同时处理POST/GET,而不知道实际使用的是哪一个。但不确定这是否能解决您的问题。