以下是我正在建设的网站的结构:
我有first.php,其中包括second.php。
在second.php中,我有一个表单的链接,我有$ _GET来获取在此结构的最后一页发送的url参数。
form.php告诉action.php(这个结构的最后一页),switch case是FORM。 在案例FORM我有:
header("Location: second.php?param1=OK¶m2=OK");
使用这一行我用参数加载second.php页面,但我需要加载的是first.php页面,包括second.php以及参数,所以我可以使用$ _GET
我有什么方法可以做到吗?在结构下面。
非常感谢!
first.php
I'm the first page<br><br>
<div style="width:500px;height:500px;border:2px solid red;"><?php include "second.php" ?></div>
second.php
<?php
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];
?>
<script language="javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$(document).ready(function(){
$("#theform").click(function(theevent){
$("#pre_target").html('<div id="target"></div>');
theform();
});
})
function theform() {
$("#target").load("form.php", {}, function(){ });
}
</script>
I'm the second page
<div id="pre_target">
<a href="#" id="theform">Go to form</a>
</div>
form.php的
<form method="post" action="action.php">
<input type="hidden" name="ACTION" value="FORM">
<input type="submit" value="submit" name="submit">
</form>
action.php的
<?php
switch($_REQUEST["ACTION"]) {
case "FORM":
header("Location: second.php#pre_target?param1=OK¶m2=OK");
break;
.
.
.
?>
答案 0 :(得分:2)
如果我理解你的问题,只需用'first.php'替换'second.php'即可。 GET变量是SUPER Globals,意味着它们是超级的,全局的。如果first.php包含second.php,则second.php和first.php将共享相同的GET变量。
header("Location: second.php?param1=OK¶m2=OK");
更改为:
header("Location: first.php?param1=OK¶m2=OK");