title: EXACTLY the same html, why does it behave different?
body: <p>I have a problem that I really cannot figure out how to solve. I have 2 different pages of the same project. It allows users to create a form and submit it to a different webpage. And there are 2 versions, one that just request the fields types, names and values, and another that allows users to input the full form manually.</p>
  
  <p>So, as my question stated, in the first case it works perfectly, and in the second case it comes back to the same page, and it's driving me crazy! I will put the code at the end, but now the steps to reproduce the error. So far it's a page hosted for free as I'm using it for testing purposes:</p>
  
  <ol>
  <li>Go to <a href="http://saveyourself.vacau.com/form/" rel="nofollow">http://saveyourself.vacau.com/form/</a></li>
  <li><p>Put this in the fields (this is actually a test account for this page):</p>
  
  <ul>
  <li>Page: <a href="http://newfutureuniversity.org/" rel="nofollow">http://newfutureuniversity.org/</a></li>
  <li>Method: "Post"</li>
  <li>Name 1: "User"</li>
  <li>Value 1: "User"</li>
  <li>Type 1: "text"</li>
  <li>Name 2: "Pass"</li>
  <li>Value 2: "Password"</li>
  <li>Type 3: "Password"</li>
  <li>Name 3: "Login"</li>
  <li>Value 3: "1"</li>
  <li>Type 3: "Hidden".</li>
  </ul></li>
  <li><p>Press "Show form", and the form will be displayed</p></li>
  <li>Now see the source code of the page, and copy from "<code>&lt;form...&gt;</code>" to "<code>&lt;/form&gt;</code>"</li>
  <li>Go to this page <a href="http://saveyourself.vacau.com/form/manual/" rel="nofollow">http://saveyourself.vacau.com/form/manual/</a> and paste it there.</li>
  <li>Press "Show form", and you should get to EXACTLY the same page as you got after step 3 (check the html, it's 100% the same, the only change is the address, /manual/).</li>
  </ol>
  
  <p>Now, here is the trick. Despite both pages have exactly the same html, if you press the button "Send form" after step 3, you would be logged into the new page, but if you press the button "Send form" after step 6 (in /form/manual/ ), that page is refreshed and the form that you pasted is deleted. How is this possible? As far as I know, there is no PHP involved here, as when the form is displayed, it's just plain html and the new page should handle the whole PHP. So, if it receives the same form, it should answer in the same way, right? In the second page it's not used the "$_SERVER['HTTP_REFERER'];" (where the visitor comes from), nor anything similar. Also, there's 0 javascript. I post now the html in case it helps, and some of the PHP (not to put too much code).</p>
  
  <p>So the question is, <strong>does anyone have any idea of why the second form doesn't work?</strong></p>
  
  <p>Thank you so much.</p>
  
  <p><strong>HTML code (it's the same in both pages after step 3 or 6):</strong></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
          &lt;title&gt;Send form&lt;/title&gt;
          &lt;meta content="text/html; charset=utf-8" http-equiv="content-type" /&gt;
  &lt;/head&gt;
  &lt;body style="background: #DDFFFF; width: 80%; height:100%; margin: 0 10% 0 10%; text-align: center;"&gt;
  &lt;h1&gt;Send form&lt;/h1&gt;
  
      &lt;form action="http://newfutureuniversity.org/" method="POST"&gt;
          Web page: http://newfutureuniversity.org/&lt;br&gt;
          Method: POST&lt;br&gt;&lt;br&gt;
          &lt;table style="margin-left: auto; margin-right: auto;"&gt;
                              &lt;tr&gt;
                  &lt;td style="text-align: right;"&gt;
                  User:&lt;/td&gt;&lt;td&gt;&lt;input type='text' name='User' value=''&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                                  &lt;tr&gt;
                  &lt;td style="text-align: right;"&gt;
                  Pass:&lt;/td&gt;&lt;td&gt;&lt;input type='password' name='Pass' value=''&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                                  &lt;tr&gt;
                  &lt;td style="text-align: right;"&gt;
                  Login:&lt;/td&gt;&lt;td&gt;&lt;input type='text' name='Login' value='1'&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                          &lt;/table&gt;&lt;br&gt;
          &lt;input type="submit" value="Send form"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Simplified PHP code from the page working ( <a href="http://saveyourself.vacau.com/form/" rel="nofollow">http://saveyourself.vacau.com/form/</a> ):</strong></p>
  
  <pre><code>//Header, body and others go before of this
  &lt;?php
  if ($_POST['sent']==1&amp;&amp;empty($_POST['source'])) //If form is submited
      {
      $i = 1;
      ?&gt;
      &lt;form action="&lt;?php echo $_POST['page']; ?&gt;" method="&lt;?php echo $_POST['method']; ?&gt;"&gt;
          Web page: &lt;?php echo $_POST['page']; ?&gt;&lt;br&gt;
          Method: &lt;?php echo $_POST['method']; ?&gt;&lt;br&gt;&lt;br&gt;
          &lt;table style="margin-left: auto; margin-right: auto;"&gt;
              &lt;?php 
              while (!empty($_POST['nam'.$i]))
                  { ?&gt;
                  &lt;tr&gt;
                  &lt;td style="text-align: right;"&gt;
                  &lt;?php echo $_POST['nam'.$i].":&lt;/td&gt;&lt;td&gt;&lt;input type='".$_POST['typ'.$i]."' name='".$_POST['nam'.$i]."' value='".$_POST['val'.$i]; ?&gt;'&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;?php
                  $i++;
                  }
              ?&gt;
          &lt;/table&gt;&lt;br&gt;
          &lt;input type="submit" value="Send form"&gt;
      &lt;/form&gt;
  &lt;?php
      }
  
  
  elseif (!empty($_POST['source']))   //If user just wants to create a form and see the code
      {
      //I think this bit is irrelevant codereview, so I skipped it.
      }
  
  
  else        //Body of the first page shown
      { ?&gt;
  &lt;form method="post"&gt;
      Web page: &lt;input type="text" name="page"&gt; 
      Method to send: &lt;select name="method"&gt;&lt;option value="POST"&gt;Post&lt;/option&gt;&lt;option value="GET"&gt;Get&lt;/option&gt;&lt;/select&gt;&lt;br&gt;
  
      &lt;table style="border: 1px solid #AAA; margin-left: auto; margin-right: auto;"&gt;
          &lt;tr&gt;
              &lt;td&gt;Number&lt;/td&gt;
              &lt;td&gt;Name&lt;/td&gt;
              &lt;td&gt;Value&lt;/td&gt;
              &lt;td&gt;Type&lt;/td&gt;
          &lt;/tr&gt;
  &lt;?php for ($i = 1; $i &lt;= 10; $i++)
      { ?&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $i; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="nam&lt;?php echo $i; ?&gt;"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="val&lt;?php echo $i; ?&gt;"&gt;&lt;/td&gt;
              &lt;td&gt;
              &lt;select name="typ&lt;?php echo $i; ?&gt;"&gt;
                  &lt;option value="text"&gt;Text&lt;/option&gt;
                  &lt;option value="password"&gt;Password&lt;/option&gt;
                  &lt;option value="radio"&gt;Radio&lt;/option&gt;
                  &lt;option value="checkbox"&gt;Checkbox&lt;/option&gt;
                  &lt;option value="hidden"&gt;Hidden&lt;/option&gt;
                  &lt;option value="reset"&gt;Reset&lt;/option&gt;
                  &lt;option value="submit"&gt;Submit&lt;/option&gt;
              &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;?php } ?&gt;
      &lt;/table&gt;&lt;br&gt;
  
      Don't worry, a submit button is automatically added.&lt;br&gt;
      &lt;input type="hidden" name="sent" value="1"&gt;
      &lt;input type="submit" value="Show form"&gt;
      &lt;input type="submit" name="source" value="Form code"&gt;
      &lt;/form&gt;&lt;?php } ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Full PHP code from the page not working ( <a href="http://saveyourself.vacau.com/form/manual/" rel="nofollow">http://saveyourself.vacau.com/form/manual/</a> ):</strong></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;Send form&lt;/title&gt;
      &lt;meta content="text/html; charset=utf-8" http-equiv="content-type" /&gt;
  &lt;/head&gt;
  &lt;body style="background: #DDFFFF; width: 80%; height:100%; margin: 0 10% 0 10%; text-align: center;"&gt;
  &lt;h1&gt;Send form&lt;/h1&gt;
  
  &lt;?php
  if ($_POST['sentbrr']==1)   //If form is submited
      echo stripslashes($_POST['code']);
  
  else    //First time
      { ?&gt;
      &lt;form method="post"&gt;
      Enter the code for the form manually&lt;br&gt;
      &lt;textarea name="code" style="width: 100%; min-height: 450px;"&gt;&lt;/textarea&gt;&lt;br&gt;
      &lt;input type="hidden" name="sentbrr" value="1"&gt;
      &lt;input type="submit" value="Show form"&gt;
      &lt;/form&gt;
      &lt;?php
      } ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>