Archimedees Posted November 12, 2007 Share Posted November 12, 2007 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. Quote Link to comment Share on other sites More sharing options...
nuxy Posted November 12, 2007 Share Posted November 12, 2007 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(); ?> Quote Link to comment Share on other sites More sharing options...
aschk Posted November 12, 2007 Share Posted November 12, 2007 Change your die() statement to die("I died here"); And if you get "I died here" in your output then you know your if statement is failing. Quote Link to comment Share on other sites More sharing options...
obsidian Posted November 12, 2007 Share Posted November 12, 2007 If your form is using the GET method, all you have to do is create a hidden field with the values you're wanting to pass: <?php echo "<input type=\"hidden\" name=\"MyServer\" value=\"$strServer\" />"; ?> Quote Link to comment Share on other sites More sharing options...
Archimedees Posted November 12, 2007 Author Share Posted November 12, 2007 Thank you! 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.