Retaining check box values after the form is submitted in PHP -


but when form submitted not retain check boxes selected. instance if select , checked 2 check boxes how keep them checked after form submitted? thanks.

below have.

<form method='post' action=''> <?php $sqlbrands="select * brands";             $runbrands=mysqli_query($db, $sqlbrands) or die ("sql error");             $norow=mysqli_num_rows($runbrands);             $brndtable = "<table border='1' cellspacing='0' cellpadding='1' id='brndtable1' class='brndtable1'>";             $brndtable .= "<thead><tr><th class='brt11'>brand name</th><th class='brt21'>variant</th><th class='brt31'>sku</th><th class='brt41'></th></tr></thead>";             $brndtable .= "<tbody>";             while ($rek = mysqli_fetch_array($runbrands))             {                 $wec = $rek['id']; $wec2 = $rek['bvariant']; $wec3 = $rek['bsku'];                 $brndtable .= "<tbody class='colormine'><tr>";                 $brndtable .= "<td class='brt1'>".$rek["bname"]."</td>";                 $brndtable .= "<td class='brt2'>".$rek["bvariant"]."</td>";                 $brndtable .= "<td class='brt3'>".$rek["bsku"]."</td>";                 $brndtable .= "<td class='brt4'><input type='checkbox' name='checkedme[]' value='$wec' /></td>";                 $brndtable .= "</tr>";             }             $brndtable .= "</tbody>";             $brndtable .= "</table>";               echo $brndtable; ?> <input type="submit" name="sendone" id="sendone" value="oneclick"> </form> 

you need store settings of these checkbox values on server (perhaps in database). then, next time php script presents form users, php script should query information, , write checked attribute check checkboxes should checked.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -