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;
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.
Look at your php.ini
parameter max_input_vars = 2500
the default is 2500, but yours maybe set differently. I would guess that you have exceeded that with this form
Try increasing it to a value that matches a count of all your forms inputs
max_input_vars = 3500