通过 PHP 和主键连接表单


connect forms through php and primary key

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

例如

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

form1.php 

---第二个表单,其中第 1 页基于表单 1 的输入

form2.php?page1=primary key 

---第三种形式,其中第 1 页基于表单 2 的输入

form3.php?page2=primary key 

---第四种形式,其中第 2 页是第 1 页

form4.php?page3=primary key 

---第四种形式,其中第 3 页是第 2 页

依此类推,直到最后一页。我的问题是如何连接它们?如何检索主表单并将其传递给所涉及的所有表单?到目前为止,我只能将主键传递到 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");
}

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

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

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

 $current=$_GET['page1'];

还有一个人认为提交按钮将单击加载中的表单操作

你可以试试这个

<form id="form1" name="form1" method="post" action="eval_2.php?page1=form1">

您没有正确实例化变量。

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

试试这个

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