All selected rows not submitted on form submit

Discussing Html . Code , Software , other

Moderators: egami, macek, gesf

Post Reply
mperemsky
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Sep 14, 2021 6:44 am

Wed Sep 15, 2021 5:46 am

I have an HTML table located within a form. The first column of the table is a checkbox. When the form is submitted, it opens a popup window and calls another php file to process the selected items in the table. However, it never sends more than 1000 items from the table and I don't know why. The initial code used a GET for the form submission, which I changed to a POST, but that did not help.

Here is the form definition

Code: Select all

<form id="scanform" method="POST" action="launchscan.php" target="scan_window">
Here if the selection box that the user chooses to kick off the process that is failing to receive all the records

Code: Select all

        <span style="float:right;">
                Select Scan on Selected Hosts:
                <select name="scan_type">
                        <option value="ttlsearch">Title Search</option>
                        <option value="ipscan">IP Scan</option>
                </select>
                <input type="button" onclick="launchscan()" value="Scan">
        </span>
Here is the table definition from which rows are selected

Code: Select all

         <table id="home" width="100%" cellspacing="0" align="center" class="display">
                <thead>
                <tr>
                        <th><input type="checkbox" onClick="toggle(this)"/></th>
                        <th>IP</th>
                        <th>DNS</th>
                        <th>Port</th>
                </tr>
                </thead>
                <tbody>
                <tr class="item">
                <td><input type="checkbox" name="selected[]" value="111.111.111.111:443:abc.com"/></td>
                <td>111.111.111.111</td>
		<td>abc.com</td>
		<td>443</td>
		</tr>
               ...repeat...
</tbody>
</table>
</form>
 
Here is the JavaScript for the button call

Code: Select all

function launchscan() {
        window.open('', 'scan_window',"height=400,width=600");
        var all = document.body.getElementsByTagName("*");
        document.getElementById('scanform').submit();
}
Here is the snippet of code from launchscan.php. This code processes the selected rows in the HTML table. If I select over 1000 rows it never sends more than 1000. I cannot determine why.

Code: Select all

if(isset($_REQUEST['selected'])){
    foreach($_POST['selected'] as $selected){
        $split = explode(':', $selected);
        $line = $split[1] . "," . $split[2] . "," . $split[0] . "\n";
        fwrite($Handle,$line);
    }
    fclose($Handle);
    echo "Input File $filename written.<br>";
}
else{
    echo "not selected\n";
}
If anybody can give me some insight into this I would be appreciative. I am just getting back into php and this is a bit confounding.
TIA
User avatar
Strider64
php-forum GURU
php-forum GURU
Posts: 429
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Thu Sep 16, 2021 2:38 am

My suggestion would to get the PHP to work first then add the JavaScript. HTML tables should only be used to display data like a spreadsheet does and that is the only time I would use a table. I think you need to revise your logic on that part. Just my .02 cents...
Life is a fig newton of your imagination! https://www.phototechguru.com/
mperemsky
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Sep 14, 2021 6:44 am

Thu Sep 16, 2021 5:10 am

Everything is working. The only issue is that, if I select more than 1000 rows I do not receive the extra rows. This was pre-existing code. I am maintaining it, I am just trying to determine why it refuses to send over 1k selected rows. Initially, I thought it was because the form was using GET, so I changed it to POST, but that did not help.
mperemsky
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Sep 14, 2021 6:44 am

Tue Sep 21, 2021 9:48 am

The issue was that the

Code: Select all

max_input_vars
was set to the default of 1000 in the php.ini file.
MrRyan
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Oct 14, 2021 6:20 pm

Thu Oct 14, 2021 6:31 pm

Thanks for this great information! will keep it in mind.

Ryan for https://www.newhavencontractor.net
Post Reply