Jump to content

[SOLVED] passing Get variables


Archimedees

Recommended Posts

 

Below echo is inside a form, I want to pass the $strServer using Get method.

 

echo "<td> name=\"MyServer\"value=\"$strServer\"</td>\n";

 

in the next file where the variable is to be passed I want to obtain the $strServer.

 

 

if (array_key_exists("submit", $_GET))

    {

      $strMyServer = $_GET["MyServer"];

       

     

    }// end of if (array_key_exists("submit", $_GET))

    else

    {

      die();

    }//end of else

 

 

 

Something is wrong with the outlined codes. Please pinpont what is wrong. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/76993-solved-passing-get-variables/
Share on other sites

Hi Archimedees,

 

You could simply use a link to do this.

Also, you method of checking an get value is a bit extensive.

 

Here is an example:

echo '<td><a href="?MyServer="' . $strServer . '">MyServer</a></td><br>';

 

<?php
if (!empty($_GET['MyServer']))
      $strMyServer = $_GET['MyServer'];
else
      die();
?>

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.