dphw5101 2017-01-09 13:53
浏览 83
已采纳

PHP POST不发送所有输入

A mysql query is grabbing data from my database and posts it into input fields in a table via while-loop. This works fine, all 252 expected table rows are shown. Pushing the submit button on the respective PHP page shall send the data to a calculation script and (re-) write data into the db.

Problem: Only 200 rows are coming through to the processing page. I.e. 52 lines do not come through. I have set up a quick script to check the output and this also shows that only 200 rows come through.

What I found out already: As soon as I reduce the table row by row the number of data put through is increasing. With only 3 rows (tipp_id, tipp_heim, tipp_gast) all 252 rows come through.

Is there a limit of throughput I'm not aware of? Or any ideas how to solve that problem?

Query & table (table includes 252 rows):

$records = mysqli_query($conn, "
    SELECT
        sp.spiel_id,
        sp.tore_heimteam,
        sp.tore_gastteam,
        t.match_id,
        t.tipp_heim,
        t.tipp_gast,
        t.tipp_id
    FROM 
        spielplan sp
    LEFT JOIN tipps t
        ON sp.spiel_id = t.match_id
");
while($fields = mysqli_fetch_assoc($records)) {
?>
    <tr>
        <td><input type="text" name="tipp_ids[]" value="<?php echo fields["tipp_id"] ?>"></td>
        <td><input type="text" name="goals_hometeams[]" value="<?php echo $fields["tore_heimteam"] ?>"></td>
        <td><input type="text" name="goals_guestteams[]" value="<?php echo $fields["tore_gastteam"] ?>"></td>
        <td><input type="text" name="tipp_guestteams[]" value="<?php echo $fields["tipp_gast"] ?>"></td>
        <td><input type="text" name="tipp_hometeams[]" value="<?php echo $fields["tipp_heim"] ?>"></td>
    </tr>

Script to check POST output (output = 200 rows):

$goalsHome = $_POST['goals_hometeams'];
$goalsGuest = $_POST['goals_guestteams'];
$tippHomes = $_POST['tipp_hometeams'];
$tippGuests = $_POST['tipp_guestteams'];
$tipp_id = $_POST['tipp_ids'];

$i=0;
foreach($goalsHome as $key => $ghome) {
    $i++;
    echo $ghome.";";
    echo $goalsGuest[$key].";";
    echo $tippHomes[$key].";";
    echo $tippGuests[$key].";";
    echo $tipp_id[$key].";";
    echo "<br>";
}
echo $i;
  • 写回答

2条回答 默认 最新

  • dougou1943 2017-01-09 13:56
    关注

    I believe you might be hitting your max_input_vars limit. Default is 1000.

    You can solve this by editing your php.ini. (see: This post on SO)

    Although I'd suggest changing the interface.

    A little elaboration in the interface thing;

    If you're trying to have your visitors fill out 1000+ input fields, go with the increased max_input_vars option. Period.

    BUT, if the input fields are actually just a frontend mechanic, you're using them wrong (in my opinion). Input fields are what they are, INPUT fields. If you don't require input from your end-user, don't use an input field. You can use any HTML element at your disposal to show data.

    If you only need one or two values from the user. Only ask for those one or two values. Maybe create a little javascript popup requesting the input you need. From there you can recalculate the data and post it back into your database with an xhttp request.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线