• Resolved Qwhat

    (@qwhat)


    Hi,
    Great plugin. Thanks.
    I’m trying to use your filter to add multiple fields to the post content. It’s working correctly for simple fields, but not for arrays. I’m trying to use this with Drag and drop multiple file uploads (mfile) and select multiple files (I’ve installed select2 jquery library).
    I’ve tried to use classic php notation :
    if(isset($form_data[‘upload-file-136’])){
    foreach ($form_data[‘upload-file-136’] as $photos) {
    echo $photos .”<br />”;
    }
    Any chance you can put me in the right direction or give me some examples.
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Qwhat

    (@qwhat)

    Sorry to bother you, I figured it out :
    I used your example of creating post content with multiple fields where you use
    // $form_data is the submitted form data as an array of field-name=>value pairs
    so
    $value = ‘<div id=”form-field-content”>’;

    so I should have put something like this:
    if(isset($form_data[‘menu-319’])){
    $value .= ‘<div class=”type_de_piece”><i>Couleur(s) souhaité(s) :</i> <br />’;
    foreach ($form_data[‘menu-319’] as $couleurs) {
    $value .= $couleurs. ‘<br />’;
    }
    ‘</div>’;
    }
    I’ll probably have other questions later. Thanks anyways

    Plugin Author Aurovrata Venet

    (@aurovrata)

    hi, glad you figured it out.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    PS: note that any files submitted are accessible through the $_FILES variable. the $_POST has only limited value for submitted file fields.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Insert array data in post_content’ is closed to new replies.