In the database, the media table has the structure: id, attachment_url, title, alt Make a SELECT query * FROM media Display via while:
$media_id = $media[id] <img src=\"$media[attachment_url]\"> alt: <input type='text' name='$media_id[alt]' value='$media[alt]'> title: <input type='text' name='$media_id[title]' value='$media[title]'> When forming each input field, an error occurs: Warning: Illegal string offset 'alt' and ... 'title'
This is how it works:
alt: <input type='text' name='alt[$media_id]' value='$media[alt]'> title: <input type='text' name='title[$media_id]' value='$media[title]'> If the field name is input alt [$ media_id] and title [$ media_id], then the data is transmitted in two arrays 'alt' and 'title', where the value of the input field corresponds to $ media_id. But this is inconvenient, since there will be META fields, a text description for the photo and so on. It turns out that in order to write data, I need to pass each array of 'alt' and 'title' through a loop. I would like to get a few arrays with the names media_id with elements whose keys will be 'alt' and 'title'
How to do it?