sending Input type=image to database results by undefined index

Viewed 37

I try to send image from wordpress media selector to my database. I must display the image inside input. The goal is to do same thing as wordpress media selector (featured image) in my own plugin: I click on "add a featured image" (button), I choose an image, and it displays inside input type=image. type=file doesn't display image and overwrite the uploader. I don't want that. For this example I added input type="image" inside button but these is added by jquery.

The error is : undefined index : aac_image

on this line : 'logo_img' => $_POST['aac_image'],

<button type="button" class="atv_btn" id="btnImage">
            <!--<span>Ajouter une image</span>-->
            <input type="image" src="https://website.com/wp_content/uploads/myimage.png" id="getImage" name="aac_image" height="180" width="260">
        </button>

$table = $wpdb->prefix.'organization_data';
    $data = array(
        'id' => $genId,
        'name' => $_POST['aacl_title'],
        'nicname' => $Acronyme,
        'logo_img' => $_POST['aac_image'],
        'informations' => $_POST['aac_description'],
        'mgmt_activated' => 1
    );
0 Answers
Related