0

入力の 1 つを主キーの形式として使用して、フォームを接続しようとしています。

例えば、

--- 主キーが取得される最初の形式

form1.php 

--- 2 番目のフォーム。ここで、page1 は form1 からの入力に基づいています

form2.php?page1=primary key 

--- 3 番目のフォーム。ここで、page1 は form2 からの入力に基づいています

form3.php?page2=primary key 

---4 番目の形式、ここで、page2 は page1

form4.php?page3=primary key 

---4 番目の形式、ここで、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'];

そしてもう1つは、送信ボタンがロードされたフォームのアクションをクリックすると思います

これを試してみてください

<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 に答える