2011-04-14 76 views
1

这里的网站我建立的结构:头位置:加载内容到页面的div

我有first.php,其中包括second.php。

在second.php中我有一个链接到一个表单,我有$ _GET来获取在这个结构的最后一页发送的url参数。

form.php告诉action.php(此结构的最后一页)切换案例是FORM。 内箱形状,我有:

header("Location: second.php?param1=OK&param2=OK"); 

这一行我加载页面second.php与参数,但我需要加载是包括与参数一起second.php这样我就可以使用first.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&param2=OK"); 

    break; 

    . 
    . 
    . 
    ?> 
+2

酷乌尔建设'web'?你如何做到这一点? :-p – Neal 2011-04-14 16:15:48

回答

2

如果我正确理解您的问题,只需将'second.php'替换为'first.php'即可。 GET变量是超级全局变量,意思是超级变量和全局变量。如果first.php包含second.php,second.php和first.php将共享相同的GET变量。

header("Location: second.php?param1=OK&param2=OK"); 

更改为:

header("Location: first.php?param1=OK&param2=OK"); 
+0

超全局!非常感谢! – user638009 2011-04-14 16:29:10