2012-06-27 2 views
0

Я пытаюсь подключить формы, используя один из входов в качестве формы первичного ключа.подключить формы через php и первичный ключ

Например,

--- первая форма, где первичный ключ берется

form1.php 

--- вторая форма, где стр.1 основан на входе от form1

form2.php?page1=primary key 

--- третья форма, где page1 основана на вводе из формы2

form3.php?page2=primary key 

--- четвёртая форма, где стр.2 не стр.1

form4.php?page3=primary key 

--- четвёртая форма, где page3 является стр.2

и так далее, до последней страницы. Мой вопрос: как мне подключить их? как я могу получить первичный и передать его во всех формах? Пока я могу передать первичный ключ до form2, когда он достигнет формы3, он исчезает.

Кстати, после того, как каждая форма будет выполнена, она перейдет на страницу процесса.

--- ниже код для формы образца

<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"); 
} 

Где я ошибся? Что мне делать? Помогите!

ответ

2

я думаю, что вы не пропускал ни строки

запроса в поле ниже переменной будет нулевым нет значения параметра Присвоить стр.1

$current=$_GET['page1']; 

и еще один думаю, что кнопка отправить будет нажать действие формы в нагруженном

может у попробовать это

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

стр.1 назначается как '$ тока = $ _ POST [ 'студент']; header ("Location: performanceeval2.php? Page1 = $ current"); ' ' $ _POST ['student'] '- это вход, полученный из form1, который будет использоваться как« первичный ключ » – ayou

+0

, где u присвоено значение страницы1 .. покажите мне пл .. –

+0

, так как было бы слишком долго, чтобы опубликовать комментарий, я положил его на shrib, -> http://shrib.com/form1_ayou – ayou

0

Вы не правильно создаете свою переменную.

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

Постарайся это

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