Note that there are some explanatory texts on larger screens.

plurals
  1. PONo POST data being returned when hidden input type is present
    primarykey
    data
    text
    <p>I think that there is either an error in my code, or my PHP or Apache is set up incorrectly.</p> <p>When I submit a form with a hidden field in it, I do not get any data in my $_POST array...</p> <p>When I comment out the hidden field in my code, the POST data is returned correctly...</p> <p>HTML FORM</p> <pre><code>&lt;form action='/utils/login.php ' method='POST'&gt; &lt;table&gt; &lt;tr&gt; &lt;td colspan='2'&gt; Login &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; Username &lt;/td&gt; &lt;td&gt; &lt;input type='text' name='userid' value='' size='12' /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; Password &lt;/td&gt; &lt;td&gt; &lt;input type='password' name='password' size='12' /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type='hidden' name='formtype' value='login' /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type='submit' value='Submit' /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/form&gt; </code></pre> <p>Here is the code that is processing it in PHP...</p> <pre><code>foreach ($_POST as $var =&gt; $value) { echo "$var = $value&lt;br&gt;"; } </code></pre> <p>I am using PHP 5 and Apache 2.2 on my server.</p> <p>Any ideas?</p> <p>EDIT...</p> <p>I have narrowed it down to this...</p> <pre><code>$command = $_POST['formtype']; </code></pre> <p>When I removed the @ sign from my $_POST, I am getting the following error...</p> <p>Notice: Undefined variable: formtype in C:\webroot\utils\login.php on line 17</p> <p>If I comment out that line, the POST data is passed into the program without a problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload