Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:48:36+00:00 2026-05-16T17:48:36+00:00

Please have a look to the following code: <?php $nomeDominio=”; if (isset($_GET[‘infoDominio’])) { $nomeDominio

  • 0

Please have a look to the following code:

<?php

  $nomeDominio='';

  if (isset($_GET['infoDominio']))
  {          
      $nomeDominio = $_GET['nomeDominio'];
      echo "I'm getting ".$nomeDominio;
  }

  if (isset($_POST['atualizarDominio']))
  {
      echo "I'm posting ".$nomeDominio;
  }

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Test Case 99</title>
    </head>

    <body>

        <form name="infoDominio" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>"  method="get">

            <input id="nome_dominio" type="text" name="nomeDominio" value="<?php echo $nomeDominio; ?>"/>
            <br />
            <button name="infoDominio" type="submit">Obtem informacao</button>

        </form>

        <form action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" name="atualizarDominio" method="post">

            <input type="hidden" value="<?php echo $nomeDominio ?>" name="nome-dominio"/>
            <br />
            <button type="submit" name="atualizarDominio">atualizar domínio</button>

        </form>

    </body>

</html>

You can copy/paste – it will serve as test case.

Like this, IF we get and then we post:
The value from GET WILL NOT pass into POST.

The thing is:
If we just change the action= property of the second form element to, instead of having the $_SERVER[‘PHP_SELF’], to have just action=””;
you will notice that the value WILL pass.

My question is:
Why?

ADDITIONAL NOTE:
This is not something to solve. Instead, this is something to understand why is it happening this way.
Why, if we change the action on the second form to action=””, the value stored in $nomeDominio pass from one conditional into another? The code sample can be used by itself, so you can perfectly test this very easily and see what I’m talking about.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:48:36+00:00Added an answer on May 16, 2026 at 5:48 pm
     {          
          $nomeDominio = $_GET['nomeDominio'];
          echo "I'm getting ".$nomeDominio;
      }
    
      if (isset($_POST['atualizarDominio']))
      {
          $nomeDominio = $_POST['nomeDominio']; //THIS HERE
          echo "I'm posting ".$nomeDominio;
      }
    

    you are missing the line with comment THIS HERE

    You wanted to pass the _GET[‘nomeDominio’] from the first form to a hidden field of the second form right? Then when we submit the SECOND form you echo nomeDominio’s value again (from the second form’s hidden field).
    You where missing and assignement in the $_POST: $nomeDominio = $_POST[‘nomeDominio’];

    There you go. If you do not undesrtand I do not know how to say differently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please look the following code: <?php if ($_GET['picture'] == 1) { echo <img src=\1.jpg\
please have a look at the following code import java.util.ArrayList; import java.util.List; public class
Please have a look at the following code namespace Funny { class QuesionsAndAnswers {
Please have a look at the following code: $(#saveButton).click(function(){ $this = $(#tableData).find(input:checked).parent().parent(); tea =
Please have a look at the following code package Euler; import java.util.ArrayList; import java.util.List;
Please have a look at the following machine code ‎0111001101110100011100100110010101110011011100110110010101100100 This means something. I
am new here. i have a slight problem; PLease look at the following code
Please have a look at following code : import java.util.ArrayList; import java.util.List; class Main{
Please have a look at the following code, which I have run in VB6
Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.