Jump to content

New Checked checkboxes problem


Archimedees

Recommended Posts

 

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?

Link to comment
https://forums.phpfreaks.com/topic/81484-new-checked-checkboxes-problem/
Share on other sites

<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>

 

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.