亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - The principle of passing an array to php when the name of the form object is xx[]
迷茫
迷茫 2017-05-16 13:07:31
0
3
413

<form method="post" action="arrayformdata.php">
<label>Tags</label>
<input type="text" name="tags[]" />
<input type="text" name="tags[]"/>
<input type="text" name="tags[]"/>
< input type="text" name="tags[]"/>
<input type="text" name="tags[]"/>
<input type="submit" value= "submit">
</form>
</html>

In this way, you can get all the values ??named tags[] through $_POST['tags'] in php and merge them into an array.
I don’t understand how it works

迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

reply all(3)
Peter_Zhu

When submitting, you can see that the requested form information is

tags[]: 111
tags[]: 222

When PHP receives this information, it will pass the variables into the current script in the form of an associative array. Since it is an associative array, there will be keys, and the tags[] above are the same set of keys. PHP will put them into an array when processing.

巴扎黑
$array=[];
for($i=0;$i<100;$i++){
    $array[]=$i;
}
print_r($array);

I think it should be the same as this. It's because the PHP side does the processing (I don't know about other back-end languages). Because what was sent to the front desk is like this, as shown in the picture

某草草

Same meaning as above, all input boxes submitted are assigned to $_POST, $_POST is a super global variable, so it can be received anywhere

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template