0

我正在尝试使用其中一个输入作为主键形式来连接表单。

例如,

---采用主键的第一种形式

form1.php 

---第二种形式,其中page1基于来自form1的输入

form2.php?page1=primary key 

--- 第三种形式,其中 page1 基于来自 form2 的输入

form3.php?page2=primary key 

---第四种形式,其中page2为page1

form4.php?page3=primary key 

---第四种形式,其中page3为page2

以此类推,直到最后一页。我的问题是如何连接它们?我如何检索主文件并将其传递给所有涉及的表单?到目前为止,我只能将主键传递给form2,当它到达form3时,它就会消失。

顺便说一句,在完成每个表单之后,它会进入一个流程页面。

---下面是示例表单的代码

<form id="form1" name="form1" method="post" action="eval_2.php">
            <table width="100%" border="0" cellpadding="2" cellspacing="0">

            <tr>
            <td width="70%">
            <strong>1. Quality of Work </strong><br />
            - refers to his/her ability to work with thoroughness.
            </td>
            <td align="center"> <select name="qualityremark">
              <option>Select Remark</option>
              <option>O</option>
              <option>VS</option>
              <option>S</option>
              <option>US</option>
              <option>P</option>
            </select></td>
            </tr>

            <tr>
            <td width="70%" height="10%"> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; a. Works outstandingly accurate and complete in details</td>
            <td width="30%" align="left"> O - Outstanding </td>
            </tr>
            <tr>
            <td width="70%"> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; b. Does thorough work; rarely commit errors</td>
            <td width="30%" align="left"> VS - Very Satisfactory </td>
            </tr>
            <tr>
            <td width="70%"> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; c. Fairly completes work with few errors</td>
            <td width="30%" align="left"> S - Satisfactory </td>
            </tr>
            <tr>
            <td width="70%"> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; d. Work is often incomplete, inaccurate</td>
            <td width="30%" align="left"> US - Unsatisfactory</td>
            </tr>
            <tr>
            <td width="70%"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e. Very careless work; errors frequently repeated</td>
            <td width="30%" align="left"> P - Poor</td>
            </tr>
            <tr>
            <td> Comments: </td>
            <td></td>
            </tr>
            <tr>
            <td><textarea name="qualitycomment" cols="80" rows="5" id="qualitycomment"></textarea></td>
            </tr>
            </table>    
            <tr>
            <td></td>
            <td><div align="right">
            <a href="performanceeval.php">Back</a>&nbsp;|&nbsp;
            <!--<a href="performanceeval3.php">Next</a> -->
            <input type="submit" value="Next" name="next" id="next" class="silver_button"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
            </tr><br /> 
            </form> 

---下面是流程页面的代码

require_once("dbconnect_gentemplate.php");
require_once("attendanceClass.php");

$newAcct= new attendance();
$m=$newAcct->eval_2();

$current=$_GET['page1'];


header("Location: performanceeval3.php?page2=$current");

---下面是函数的代码

function eval_2(){ //page 2

$current=$_GET['page1'];

// $command="select recentact from ojt_evaluation";
// $commando=mysql_query($command) or die("Error ".mysql_error());
// $commander=mysql_fetch_array($commando);

// $current=$commander['recentact'];
// $cur=md5($current);

 if(isset($_POST['next'])){ 
    $qualityremark=$_POST['qualityremark'];
    $qualitycomment=$_POST['qualitycomment'];

    if(trim($qualityremark)=="") return  "<p>Error creating account;blank qualityremark</p>";

    $sql="update ojt_evaluation set qualityremark='$qualityremark', qualitycomment='$qualitycomment' where student='$current'";

    $query=mysql_query($sql)or die ("Error".mysql_error());
    }
    // header("Location: performanceeval3.php?session=$current");
}

我哪里做错了?我该怎么办?帮助!

4

2 回答 2

2

我认为您没有传递任何查询字符串

在下面的变量中将为 null 没有分配给 page1 的参数值

 $current=$_GET['page1'];

还有一个认为提交按钮会点击加载中的表单动作

你可以试试这个

<form id="form1" name="form1" method="post" action="eval_2.php?page1=form1">
于 2012-06-27T05:38:57.133 回答
0

您没有正确实例化变量。

header("Location: performanceeval3.php?page2=$current");

试试这个

header('Location: performanceeval3.php?page2=' . $current . ');
于 2012-06-27T06:20:17.563 回答