Jump to content

passing form variables using submit


Archimedees

Recommended Posts

The following statement is in urllist form below.

echo "  <td>MyServer=".$value["name"]."</td>\n";

In ActiveServer.php I need to  process the strings in  $value["name"]  using $_Get["MyServer"] and assign it to $strServer

Could somebody please outline why so far this is not working??

Mad Techie??? Please assist. Thanks in advance.

 

 

<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)
  
  {
    echo "<tr>\n";
    echo "  <td></td>\n";
    echo "  <td><input type=\"checkbox\" name=\"active_".$key."\" value=\"active\"";
    if ($value["active"]==true)
    {
      echo "checked";
    }
    echo "></td>\n";
    echo "  <td>MyServer=".$value["name"]."</td>\n";
    echo "</tr>\n"; 
  }

?>

</table>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

 

 

Now, ActiveServer.php

 

 

<?php

if (isset($_GET["submit"]) && isset($_GET["MyServer"]))
    {
      $strServer = $_GET["MyServer"];
    
    }
    else
    {
      die();
    }//end of (isset($_Request["submit"][/quote]);

?>

 

edit: We have code tags for good reason. 

Link to comment
https://forums.phpfreaks.com/topic/76044-passing-form-variables-using-submit/
Share on other sites

I'm Not 100% sure what your asking for here (but its lates here and i have had littel sleep) but

your doing this

echo "  <td><input type=\"checkbox\" name=\"active_".$key."\" value=\"active\"";

when personally i would do this

echo "  <td><input type=\"checkbox\" name=\"active[".$key."]\" value=\"active\"";

 

the reason is, it create an array this i can access like this

foreach($_POST['active'] as $k => $V)
{
echo "$k => $v<br>"
}

 

also you have a class which we have no info on ie

read_contents_pageconf <-- whats that do ?

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.