This ia a beginner's question. If part of my form looks like this
<p>Subject name: <input type="text" name="menu" value=""
id="menu_name" /></p>
and I want to use $_POST to get the data that is submitted, is $_POST reading the form "name" or "value" or "id."
For example, using the form above, would it be
$_POST['menu'];
or
$_POST['menu_name'];
or something else
It uses the name attribute, and the value comes from the value attribute.
So you would access $_POST['menu'].
You can easily examine what's in a post with var_dump($_POST).
You could also view it directly with $HTTP_RAW_POST_DATA which is handy in some situations, or through the PHP protocol like so...
$post = file_get_contents('php://input');
Although this doesn't work with a form that has the enctype="multitpart/form-data" attribute.
The id attribute is never sent to the server.
The key for the associative array is the name attribute of the form element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With