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

Link to comment
Share on other sites

 

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.