Archimedees Posted December 13, 2007 Share Posted December 13, 2007 I have a form with checkboxes and the values of the checkboxes are derived from a file. I want user to be able to check or uncheck these boxes and thus change the values of active flag. When I check or uncheck new boxes and press submit, all the values are passed to form action file alright. The problem is when I refresh the page with the form the newly checked or unchecked boxes are back to the way it was before I changed their status. How do I solve this problem? Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 13, 2007 Share Posted December 13, 2007 post code plz Quote Link to comment Share on other sites More sharing options...
Archimedees Posted December 13, 2007 Author Share Posted December 13, 2007 <html> <head><title>bla</title></head> <body> <form name="urllist" action="ActiveServer.php" method="GET"> <table border=1> <tr> <th></th> <th></th> <th>Server</th> <?php $arPageConf = read_contents_pageconf("page.conf"); $arPingConf = read_contents_pingconf("ping.conf"); $arPageServers = create_servernamelist_pageconf($arPageConf); $arPingServers = create_servernamelist_pingconf($arPingConf); //loop through PingServers to create final List $arFinalServers = $arPageServers; foreach($arPingServers as $nKey => $arServer) { $arFinalServers = search_array($arFinalServers, $arServer); }//end foreach($arPingServers as $nKey => $strServer) foreach($arFinalServers as $key => $value) { $strServer = $value["name"]; echo "<tr>\n"; echo " <td></td>\n"; echo " <td><input type=\"checkbox\"name=\"active[]\"value=\"active_".$strServer."\""; if ($value["active"]==true) { echo "checked"; }//end if ($value["active"]==true) echo "></td>\n"; echo "<td>".$strServer."</td>"; echo "</tr>\n"; } ?> </table> <input type="submit" name="submit" value="submit"> </form> </html> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 13, 2007 Share Posted December 13, 2007 Please use tags when posting code, not tags. Ken Quote Link to comment Share on other sites More sharing options...
Archimedees Posted December 13, 2007 Author Share Posted December 13, 2007 yes indeed. <html> <head><title>bla</title></head> <body> <form name="urllist" action="ActiveServer.php" method="GET"> <table border=1> <tr> <th></th> <th></th> <th>Server</th> <?php $arPageConf = read_contents_pageconf("page.conf"); $arPingConf = read_contents_pingconf("ping.conf"); $arPageServers = create_servernamelist_pageconf($arPageConf); $arPingServers = create_servernamelist_pingconf($arPingConf); //loop through PingServers to create final List $arFinalServers = $arPageServers; foreach($arPingServers as $nKey => $arServer) { $arFinalServers = search_array($arFinalServers, $arServer); }//end foreach($arPingServers as $nKey => $strServer) foreach($arFinalServers as $key => $value) { $strServer = $value["name"]; echo "<tr>\n"; echo " <td></td>\n"; echo " <td><input type=\"checkbox\"name=\"active[]\"value=\"active_".$strServer."\""; if ($value["active"]==true) { echo "checked"; }//end if ($value["active"]==true) echo "></td>\n"; echo "<td>".$strServer."</td>"; echo "</tr>\n"; } ?> </table> <input type="submit" name="submit" value="submit"> </form> </html> Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 13, 2007 Share Posted December 13, 2007 reading what you want think this will work : echo " <td><input type=\"checkbox\" checked name=\"active[]\"value=\"active_".$strServer."\ ""; if not im sorry. Im still just learning Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.