How does php receive post data from multiple forms?

Source: Internet
Author: User
How does php receive post data from multiple forms?
 Multi-form submission
 '. $ User; echo'
'. $ Addtime;?>


My code is like this. to add more than two entries to a form, there may be five, ten, and 20 entries.


Reply to discussion (solution)

It should be implemented using arrays,

                                                                                                                                                                                                                                                             
Not tested ..

                                                                                                                                                    

Yes. use an array.

                                                                                                                                                    

Well, this is how it works to support charm. it was used once before.

Of course, it's an array.

                                                                                                                                                    



Thank you, but how did PHP write this? I wrote only one array after submission.
$ Title = $ _ POST ['title'];
$ User = $ _ POST ['user'];
$ Note = $ _ POST ['note'];

Echo '';
Print_r ($ title );
Echo'
'. Print_r ($ user );
Echo'

'. $ Note;
?>

====================
How can I change it to an array like this?

$ St = array ('Lil', '19', 'China'), array ('Wang Qiang ', '20', 'mat '), array ('Zhang Wanglei ', '29', 'actor'), array ('hu corline', '27', 'Piano instructor '));


 Multi-form submission
 '; Print_r ($ title); echo'
'. Print_r ($ user); echo'
'. Print_r ($ note); echo'
';?>

My code is like this, but why is one more output,

In addition, after submission, three one-dimensional arrays are used by default. how to create a two-dimensional array? do you need to set it in the submission form.
The two-dimensional array I want looks like this.

$ St = array ('First title', 'admin', '13-05-15 '), array ('second title', 'zhansan ', 'zhagnsan'), array ('latest message', 'Lisa ', 'note'), array ('Malaysia Airlines', 'Malaysia ', 'other description '));

Sort out the arrays submitted on the page

$out = array();foreach ($_POST as $key => $value) {foreach ($value as $k => $v) {$out[$k][] = $value[$k]}}

Not one more, but two more! Isn't there another 1 in front of the second Array?

Bool print_r (mixed expression [, bool return])

foreach($_POST['title'] as $k=>$v){    $ar[]=array($v,$_POST['user'][$k],$_POST['note'][$k]);}print_r($ar);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.