html-php How to get multiple input values for the same name on a page

Source: Internet
Author: User
HTML code:

PHP Code:

$imgs = $_FILES['imgs'];

I can only get the first one in this way. How can I get all of them? I submitted it with my form.

Reply content:

HTML code:

PHP Code:

$imgs = $_FILES['imgs'];

I can only get the first one in this way. How can I get all of them? I submitted it with my form.

`

foreach($_FILES['imgs']['name'] as $key => $row ){    echo $_FILES['imgs']['name'][$key];}

`

In different ways:


  
   
    
   dump(trim($_POST['imgs1']));dump(trim($_POST['imgs2']));dump(trim($_POST['imgs3']));
  
   

The first floor method is possible! Pass it as an array to the background, and then handle it!

Upload with Ajax, directly back to the front-end image URL ... and put it in the input box.

Front:
Back end:print_r($_POST["imgs"]);

  • Related Article

    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.