0

Simply i want to upload some product images with thumbnail, thumbnail size, thumbnail Hd thumbnail Hd size

(thumbnail, thumbnail size, thumbnail Hd thumbnail Hd size) this hole think will be construct a single product image and i can upload multiple images. that's why i am using the below markup (as example).

<tr>
    <td>Thumbnail<input type="text" name="images[single_image][thumbnail][]" id=""></td>
    <td>Thumbnail Size<input type="text" name="images[single_image][thumbnail_size][]" id=""></td>
    <td>Thumbnail Hd<input type="text" name="images[single_image][Thumbnail_hd][]" id=""></td>
    <td>Thumbnail Hd Size<input type="text" name="images[single_image][thumbnail_hd_size][]" id=""></td>
</tr>

<tr>
    <td>Thumbnail<input type="text" name="images[single_image][thumbnail][]" id=""></td>
    <td>Thumbnail Size<input type="text" name="images[single_image][thumbnail_size][]" id=""></td>
    <td>Thumbnail Hd<input type="text" name="images[single_image][Thumbnail_hd][]" id=""></td>
    <td>Thumbnail Hd Size<input type="text" name="images[single_image][thumbnail_hd_size][]" id=""></td>
</tr>

after posting the data in php i am get the images array something like below

"images" => array:1 [▼
    "single_image" => array:4 [▼
      "thumbnail" => array:2 [▼
        0 => "Thumbnail One"
        1 => "Thumbnail Two"
      ]
      "thumbnail_size" => array:2 [▼
        0 => "Thumbnail One Size"
        1 => "Thumbnail Two Size"
      ]
      "Thumbnail_hd" => array:2 [▼
        0 => "Thumbnail One Hd"
        1 => "Thumbnail Two Hd"
      ]
      "thumbnail_hd_size" => array:2 [▼
        0 => "Thumbnail One Hd size"
        1 => "Thumbnail Two Hd size"
      ]
    ]
  ]

but i don't want that, what i want is this below images array because (thumbnail, thumbnail size, thumbnail Hd thumbnail Hd size) they are belongs to each other.

$images = [
    "single_image" => [
        "thumbnail" => "Thumbnail One",
        "thumbnail_size" => "Thumbnail One Size",
        "thumbnail_hd" => "Thumbnail One Hd",
        "thumbnail_hd_size" => "Thumbnail One Hd",
        "thumbnail_hd_size" => "Thumbnail One Hd Size",
    ],
    "single_image" => [
        "thumbnail" => "Thumbnail Two",
        "thumbnail_size" => "Thumbnail Two Size",
        "thumbnail_hd" => "Thumbnail Two Hd",
        "thumbnail_hd_size" => "Thumbnail Two Hd",
        "thumbnail_hd_size" => "Thumbnail Two Hd Size",
    ]
]

Now How i can achieve the above array in HTML or if it is not possible to achieve in html; How i can achieve in PHP with array function

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.