PHP表单数据未传递

时间:2013-02-15 07:21:54

标签: php forms post

我有一个相当基本的问题,但我无法理解它。

我有一个PHP表单,它已经运行了很长时间,突然间,php表单值没有与post数据一起传递。为了解决问题,我开始从我的表单中删除一些行,我得到了某个点,因为它再次开始工作。所以我添加了一条线,它刚停止了?我根本无法解释这一点。我检查了post_max_size设置及其120米,因此无法解决问题。即使是提交按钮的POST值也没有被传递。 print_r()显示没有数据。

我的完整表格(曾经工作过)是:

<form name="form1" id="form1" action="bsassigncosts.php" method="post">
<table id="hor-minimalist-a">
    <tr>
        <th></th>
        <th>Date & Time</th>
        <th>Parked</th>
        <th><font color=red>Load Number</font></th>
        <th><font color=red>Trailer</font></th>
        <th><font color=red>Weight</font> kg's</th>
        <th><font color=red>Source</font></th>
        <th><font color=red>Destination</font></th>
        <th><font color=red>Cycle Type</font></th>
        <th><font color=red>Rate to be applied</font></th>
        <th>LOC Status / Comments</th>
    </tr>

<? while($row = $loads->fetch(PDO::FETCH_ASSOC)) { ?>
    <tr>
        <td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<? echo $row['loadnumber']; ?>"></td>
        <td><? echo $row['sarrive']; ?></td>
        <td><input type="radio"  <? if($row['parkinglot']==="yes"){echo "checked='checked'";} ?> disabled >&nbsp;</td>
        <td><input type="text" name="correctedloadnumber<? echo $row['loadnumber']; ?>" id="correctedloadnumber<? echo $row['loadnumber']; ?>" value="<? echo $row['loadnumber']; ?>" class="inputsmall"></td>
        <td>
            <SELECT name="correctedtrailer<? echo $row['loadnumber']; ?>" id="correctedtrailer<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
            <OPTION value="<? echo $row['trailer']; ?>" selected ><? echo $row['trailer']; ?></option>
            <option>
            <?=$optionstrailer?> 
            </option>
            </SELECT> 
        </td>
            <td><input type="text" name="correctedweight<? echo $row['loadnumber']; ?>" id="correctedweight<? echo $row['loadnumber']; ?>" value="<? echo $row['weight']; ?>" class="inputsmall"></td>
        <td>
            <SELECT name="correctedsource<? echo $row['loadnumber']; ?>" id="correctedsource<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
            <OPTION value="<? echo $row['source']; ?>" selected ><? echo $row['source']; ?></option>
            <option>
            <?=$optionssource?> 
            </option>
            </SELECT> 
        </td>
        <td>
            <SELECT name="correcteddestination<? echo $row['loadnumber']; ?>" id="correcteddestination<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
            <OPTION value="<? echo $row['destination']; ?>" selected ><? echo $row['destination']; ?></option>
            <option>
            <?=$optionsdestination?> 
            </option>
            </SELECT> 
        </td>
        <td>
            <SELECT name="correctedcycletype<? echo $row['loadnumber']; ?>" id="correctedcycletype<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
            <OPTION value="<? echo $row['cycletype']; ?>" selected ><? echo $row['cycletype']; ?></option>
            <option>
            <?=$optionscycle?> 
            </option>
            </SELECT> 
        </td>
        <td>
            <SELECT NAME="rate<? echo $row['loadnumber']; ?>" id="rate<? echo $row['loadnumber']; ?>" class="select"> 
            <OPTION VALUE=0 >
            <?=$optionsrate?> 
            </option>
            </SELECT> 
        </td>
        <td><? if($row['adminstatus']="approvereject"){ if(isset($row['approvedby'])){echo "Rejected by<font color=red> ".$row['approvedby']."</font>:  ".$row['lmcomments'];}}  ?></td>    </tr>
<? } ?>
</table>

<input type="submit" name="testupdate" id="testupdate" value="Updated selected">
<input type="submit" name="park" id="park" value="Park Selected">

</form>

如前所述这曾经很好用。现在它没有。为了排除故障,我从表中删除了一些行,现在可以使用并将post值传递给下一页。

<form name="form1" id="form1" action="bsassigncosts.php" method="post">
<table id="hor-minimalist-a">
    <tr>
        <th></th>
        <th>Date & Time</th>
        <th><font color=red>Trailer</font></th>
        <th><font color=red>Load Number</font></th>
        <th><font color=red>Weight</font> kg's</th>
        <th><font color=red>Source</font></th>
        <th><font color=red>Destination</font></th>
        <th><font color=red>Cycle Type</font></th>
        <th><font color=red>Rate to be applied</font></th>
        <th>LOC Status / Comments</th>
    </tr>
<? while($row = $loads->fetch(PDO::FETCH_ASSOC)) { ?>
    <tr>
        <td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<? echo $row['loadnumber']; ?>"></td>
        <td><? echo $row['sarrive']; ?></td>
        <td>
            <SELECT name="correctedtrailer<? echo $row['loadnumber']; ?>" id="correctedtrailer<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
            <OPTION value="<? echo $row['trailer']; ?>" selected ><? echo $row['trailer']; ?></option>
            <option>
            <?=$optionstrailer?> 
            </option>
            </SELECT> 
        </td>   
        <td><input type="text" name="correctedloadnumber<? echo $row['loadnumber']; ?>" id="correctedloadnumber<? echo $row['loadnumber']; ?>" value="<? echo $row['loadnumber']; ?>" class="inputsmall"> </td>
        <td><input type="text" name="correctedweight<? echo $row['loadnumber']; ?>" id="correctedweight<? echo $row['loadnumber']; ?>" value="<? echo $row['weight']; ?>" class="inputsmall"> </td>

        <td><? if($row['adminstatus']="approvereject"){ if(isset($row['approvedby'])){echo "Rejected by<font color=red> ".$row['approvedby']."</font>:  ".$row['lmcomments'];}}  ?></td>




    </tr>
<? } ?>
</table>
</form>

如果我再添加一个条目,在下面的代码中,该帖子现在失败了。我无法理解:

<td>
    <SELECT name="correctedsource<? echo $row['loadnumber']; ?>" id="correctedsource<? echo $row['loadnumber']; ?>"  class="selectnarrow"> 
    <OPTION value="<? echo $row['source']; ?>" selected ><? echo $row['source']; ?></option>
    <option>
    <?=$optionssource?> 
    </option>
    </SELECT> 
</td>

这里的任何建议都将不胜感激。如果这是一个非常简单或愚蠢的问题,请道歉。

感谢您的时间和帮助。

1 个答案:

答案 0 :(得分:0)

这个问题的答案令人沮丧地不在于代码本身,而在于传递的表单字段的数量。

我减少了while循环中mysql行的数量,并重新提交了表单并成功处理。在research上,max_input_vars字段设置为1000.我假设这是问题的根源,并且已经与我的托管公司进行了通话,以便为我更改php.ini参数。

感谢您的帮助,