<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
天蓬老师2017-05-16 13:09:31
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.
巴扎黑2017-05-16 13:09:31
$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
某草草2017-05-16 13:09:31
Same meaning as above, all input boxes submitted are assigned to $_POST, $_POST is a super global variable, so it can be received anywhere