I want to add an image using media uploader in my customize plugin

by Gagan   Last Updated July 09, 2018 14:08 PM


function add_employee() {
        table {
            border-collapse: collapse;


        table, td, th {
            border: 1px solid black;
            padding: 20px;
            text-align: center;
   <div class="contact">
    <div class="form-wrapper">
    <form method="post" name="registration">
    <!-- Method can be set as POST for hiding values in URL-->
    <input class="input" name="name" id="name" type="text" value="">
    <input class="input" name="role" id="role" type="text" value="">
    <input class="input" name="contact" id="contact" type="text" value="">
    <input class="input" name="city" id="city" type="text" value="">
    <input class="input" name="state" id="state" type="text" value="">
    <input class="input" name="country" id="country" type="text" value="">
    <label>Technology Expertise:</label>
    <select class="input" name="technology_expertise" id="tech">
    <option value="technology Expertise">technology Expertise</option>
    <option value="SEO Expert">SEO Expert</option>
    <option value="PHP Expert">PHP Expert</option>
    <option value="JAVASCRIPT Expert">JAVASCRIPT Expert</option>
    <option value="Jquery Expert">Jquery Expert</option>
    <option value="Web Designing Expert">Web Designing Expert</option>
    <option value="WordPress Expert">WordPress Expert</option>
    <div class="text-area-wrapper">
    <div class="text-area">
    <label>About technology:</label>

    <textarea rows="7" cols="40" class="input text_markitup" name="about_technology" id="about_technology" placeholder="Enter the description of your mentioned expertise"></textarea>
    <div class="text-area">
    <label>Technology Services:</label>
    <textarea rows="7" cols="40" class="input text_markitup" name="technology_services" id="technology_services" placeholder="Enter the services which you can offer"></textarea>
    <div class="text-area">
    <textarea rows="7" cols="40" class="input text_markitup" name="skills" id="skills" placeholder="Please mention your skills that you are having..."></textarea>
    <label>Employment History:</label>
    <input type="text" class="input" name="emp_history" id="emp_history" value="">
<input type="hidden" value="" name="profileImage" id="profileImage" />
<!--<input type="text" id="#upload_image" name="images">-->
<input type="button" name="button" value="Click" onClick="open_media_uploader_image()">


    <div class="submit-btn">
    <input class="submit" id="btn" name="submit" type="submit" value="Submit">


        if(!empty($_POST['submit'])) {
          global $wpdb;
         $table_name = $wpdb->prefix . 'employee_list';
         //$table_name ="$wp_track_table";
         $name = trim($_POST['name']);
         $role = trim($_POST['role']);
         $contact = trim($_POST['contact']);
         $city = trim($_POST['city']);
         $state = trim($_POST['state']);
         $country = trim($_POST['country']); 
         $te = trim($_POST['technology_expertise']);
         $at = trim($_POST['about_technology']);
         $ts = trim($_POST['technology_services']);
         $skills = trim($_POST['skills']);
         $history = trim($_POST['emp_history']);
         $images = trim($_POST['image1']);
         $success = $wpdb->insert($table_name, array(
           "name" => $name,
           "role" => $role,
           "contact" => $contact,
           "city" => $city,
           "state" => $state,
           "country" => $country,
           "technology_expertise" => $te, 
           "about_technology" => $at,
           "technology_services" => $ts,
           "skills" => $skills,
           "emp_history" => $history,
           "img" => $images
          if($success) {
         echo ' Inserted successfully';
              } else {
           echo 'not';


Related Questions

Upload images from custom plugin using the media modal

Updated February 28, 2018 00:08 AM