POST请求中的方括号

Let's say I have a form.html that looks like this:

<form action="welcome.php" method="post">
Name: <input type="text" name="submitted[name]">
Age: <input type="text" name="age">
<input type="submit">
</form>

And a welcome.php that looks like this:

Welcome <?php echo $_POST["submitted[name]"]; ?>!<br>
You are <?php echo $_POST["age"]; ?> years old.

Why is the age displaying but not the name? I'm sure it's the square brackets. I can't change the name of the variable submitted[name]

I tried putting \, " but didn't work. What's the trick?

The square brackets on the name attribute will post an array to PHP try accessing it using $_POST['submited']['name']

The square brackets in your HTML form turn it into an array. $_POST["submitted"] is an array.

You want to read:

$_POST["submitted"]["name"];
Name: <input type="text" name="<?php echo $_POST['submitted']['name']; ?>">

Your file must have .php extehsion. (form.php)