PHP $_POST and id only, no name

Viewed 37116

Can someone please explain this to me?

I have the following code:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
 <input type="text" id="testField" />
 <input type="submit">
</form>
<br /><br />
<pre>
 <?php print_r($_POST); ?>
</pre>

This works fine on my main dev box, and on the server. However, I'm having to work remotely on my laptop at the moment. I've installed the exact same WAMPServer 2.1a build as on my dev setup, and the $_POST array is empty.

If I declare the field like:

<input type="text" name="testField" />

I get the expected output.

4 Answers

That suggest you create a textfield that you populate with the id from the drop down list whenever changed. When you post the form the textbox will show the previous id of the drop down list. You can set the textfield to hidden

Related