PHP $ _POST, what part of the form does it connect to?

This is 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 sent, is $ _POST, reads the form "name" or "value" or "identifier".

For example, using the form above, will it

$_POST['menu'];

or

$_POST['menu_name'];

or something else

+5
source share
4 answers

It uses an attribute name, and the value comes from the attribute value.

So you get access to $_POST['menu'].

You can easily check that in the message with var_dump($_POST).

$HTTP_RAW_POST_DATA, PHP-, ...

$post = file_get_contents('php://input');

form, enctype="multitpart/form-data".

id .

+7

name .

+1
$_POST['menu']; 

is the correction method. forms associated withname

+1
source

He is connected to name

$name = $_POST['name'];

You can see the whole array $_POSTby doing

var_dump $_POST;
+1
source

All Articles