隐藏价值不以表格形式提交

时间:2015-04-19 09:20:03

标签: php html

我的PHP代码是这样的,我没有在表单提交上获得“nextProcessId”。在隐藏变量中,我获得了价值,但是当我提交此表格时,我无法提交“nextProcessId”

 $processId = isset($_REQUEST['processId']) ? $_REQUEST['processId'] : 0;
     $nextProcessId  = isset($_REQUEST['nextProcessId']) ? $_REQUEST['nextProcessId'] : 0;

      if($processId > 0)
      {
       echo"<br>m". $updateStatus = "UPDATE process 
                          SET 
                          status = 'I',
                          nextProcessId = ".$nextProcessId."
                        WHERE processId = ".$processId;
        $updateStatusRes = mysql_query($updateStatus);
        if(!$updateStatusRes)
        {
          echo "Process Reverse Fail";
        }
    }

这里是我的代码在这里我提交的隐藏值“nextprocessid”隐藏就像在文本框中那样我正在获得价值但是如果我传入隐藏我无法提交此值

<form action="reciveEntry.php" method="POST" id="formId">
<table align="center" border="1"> 
    <h2 align="center">Process Recive List</h2>
<thead>
    <tr>
        <th class="table1">&nbsp;</th>
        <th class="table1">Process Date</th>
        <th class="table1">Item Name</th>
        <th class="table1">Worker Name</th>
        <th class="table1">Recive Process Name</th>
        <th class="table1">Design No</th>
        <th class="table1">Design Weight</th>
  </tr>
</thead>
</tbody>
  {section name="sec" loop=$designArray}
  <tr>
    <input type="" value="{$designArray[sec].nextProcessId}" name="nextProcessId">
    <td class="table1" align="center"><a onclick="return confirm('Do You Want To Delete??');" href="reciveEntry.php?processId={$designArray[sec].processId}">Delete</td>
    <input type="hidden" name="desWet[]" value="{$designArray[sec].desWet}">
    <td class="table1" align="center">{$designArray[sec].processDate}</td>
    <td class="table1" align="center">{$designArray[sec].itemNm}</td>
    <td class="table1" align="center">{$designArray[sec].workerName}</td>
    <td class="table1" align="center">{$designArray[sec].processNm}</td>
    <td class="table1" align="center">{$designArray[sec].dNo}</td>
    <td class="table1" align="center">{$designArray[sec].desWet}</td>
  </tr>
  {/section}
</tbody>
</table>
</form>

1 个答案:

答案 0 :(得分:1)

正如我们在聊天中讨论的那样,你需要这样做:

只需以这种方式写下你的链接:

<td class="table1" align="center"><a onclick="return confirm('Do You Want To Delete??');" href="reciveEntry.php?processId={$designArray[sec].processId}&nextProcessId={$de‌​signArray[sec].nextProcessId}">Delete</td>

PHP只是做了这些改变:

$processId = isset($_REQUEST['processId(copy form your link and past)']) ? $_REQUEST['processId'] : 0;
$nextProcessId = isset($_REQUEST['nextProcessId(copy from your link and past']) ? $_REQUEST['nextProcessId'] : 0;
echo $processId ;
echo $nextProcessId ;

注意: - 我没有写完整的代码。你已经明白了。但这只是有效的,因为我们在聊天结束时结束了。