Keep the check mark after form is submitted
<p>I have 2 forms that they need to be used to make a report. The first form gets data from the database (MariaDB) onchange of one of the cells (the on change events happens when the user checks the cell with the report) once that the cell is selected with the details of the report, those details are used on submit by the second form. Until that point everything is perfect. The problem is that I can't keep the check mark on the cell of the first form once that it is selected because the page is reloaded onchange. That makes the user believe that they didn't select any report. </p>

<p>So, what I want to do is to keep checked the cell of the first form after it gets the data from the database. Then, the user will click on "Submit" to submit the second form.</p>

<p>Kind regards and thanks in advance for your help!</p>

<pre><code>&lt;form name="f1" id="form1" action="" method="post"&gt; 
  &lt;div class="table-responsive"&gt;
    &lt;table class="table table-striped"&gt;
        &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Select&lt;/th&gt;
            &lt;th&gt;Assets &lt;/th&gt;
            &lt;th&gt;Description &lt;/th&gt;
            &lt;th&gt;Date&lt;/th&gt;
            &lt;th&gt;Action&lt;/th&gt;
        &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
                &lt;?php
                while($agency_row = $agency_stmt-&gt;fetch(PDO::FETCH_ASSOC)){
                $value1 = str_replace(' ','&amp;nbsp;',str_pad($agency_row["agency"], -10));
                $value2 = str_replace(' ','&amp;nbsp;',str_pad($agency_row["report_name"], 70));
                $formatedDate = date("D M d H:i:s Y", $agency_row["scan_end"]);
                $value3 = str_replace(' ','&amp;nbsp;',str_pad($formatedDate, 20));
                echo "&lt;tr&gt;";
                echo "&lt;td&gt;&lt;input onchange='f1.submit()'; type='checkbox' class='i-checks' name='agency' value='" . $value1 . ":" . $agency_row["report_name"] . ":" . $agency_row["scan_start"] . ":" . $agency_row["scan_end"] . "'&gt;&lt;/td&gt;";
                echo "&lt;td&gt;$value1&lt;/td&gt;";
                echo "&lt;td&gt;$value2&lt;/td&gt;";
                echo "&lt;td&gt;$formatedDate&lt;/td&gt;";
                echo "&lt;td&gt;$value3&lt;/td&gt;";
                echo "&lt;/tr&gt;";    
                }?&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;
&lt;/form&gt;

&lt;form name="f2" id="form2" action="report.php" method="post"&gt;
  &lt;input type="hidden" name="agency" value="&lt;?php echo "$agency";?&gt;"&gt;
  &lt;input type="hidden" name="report_name" value="&lt;?php echo "$report_name";?&gt;"&gt;
  &lt;input type="hidden" name="scan_start" value="&lt;?php echo "$scan_start";?&gt;"&gt;
  &lt;input type="hidden" name="scan_end" value="&lt;?php echo "$scan_end";?&gt;"&gt;
  &lt;input type="hidden" value="yes" name="isPlugName"&gt;
  &lt;input type="hidden" value="yes" name="isPlugFam"&gt;
  &lt;input type="hidden" value="yes" name="isPlugInfo"&gt;
  &lt;input type="hidden" value="yes" name="isSynopsis"&gt;
  &lt;input type="hidden" value="yes" name="isDescription"&gt;
  &lt;input type="hidden" value="yes" name="isSolution"&gt;
  &lt;input type="hidden" value="yes" name="isSeeAlso"&gt;
  &lt;input type="hidden" value="yes" name="isPlugOut"&gt;
  &lt;input type="hidden" value="plugin" name="byVuln"&gt;
  &lt;input type="hidden" value="yes" name="isCvss"&gt;
  &lt;input type="hidden" value="yes" name="isVulnPub"&gt;
  &lt;input type="hidden" value="yes" name="isExploit"&gt;
  &lt;input type="hidden" value="yes" name="isCve"&gt;
  &lt;input type="hidden" value="yes" name="isBid"&gt;
  &lt;input type="hidden" value="yes" name="isOsvdb"&gt;
  &lt;input type="hidden" value="yes" name="isCert"&gt;
  &lt;input type="hidden" value="yes" name="isIava"&gt;
  &lt;input type="hidden" value="yes" name="isCWE"&gt;
  &lt;input type="hidden" value="yes" name="isMS"&gt;
  &lt;input type="hidden" value="yes" name="isSec"&gt;
  &lt;input type="hidden" value="yes" name="isEdb"&gt;
  &lt;input type="hidden" value="yes" name="isAffected"&gt;
  &lt;input type="hidden" value="yes" name="isService"&gt;
  &lt;input type="hidden" value="4" name="critical"&gt;
  &lt;input type="hidden" value="3" name="high"&gt;
  &lt;input type="hidden" value="2" name="medium"&gt;
  &lt;input type="hidden" value="1" name="low"&gt;
  &lt;input type="submit" name="submithost" value="submit"&gt;
&lt;/form&gt;  
</code></pre>