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

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

 <?php

function add_employee() {
    ?>
    <style>
        table {
            border-collapse: collapse;


        }

        table, td, th {
            border: 1px solid black;
            padding: 20px;
            text-align: center;
        }
    </style>
   <div class="contact">
    <div class="form-wrapper">
    <form method="post" name="registration">
    <!-- Method can be set as POST for hiding values in URL-->
    <h2>Form</h2>
    <div>
    <label>Name:</label>
    <input class="input" name="name" id="name" type="text" value="">
    </div>
    <div>
    <label>Role:</label>
    <input class="input" name="role" id="role" type="text" value="">
    </div>
    <div>
    <label>Contact:</label>
    <input class="input" name="contact" id="contact" type="text" value="">
    </div>
    <div>
    <label>City:</label>
    <input class="input" name="city" id="city" type="text" value="">
    </div>
    <div>
    <label>State:</label>
    <input class="input" name="state" id="state" type="text" value="">
    </div>
    <div>
    <label>Country:</label>
    <input class="input" name="country" id="country" type="text" value="">
    </div>
    <div>
    <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>
    </select>
    </div>
    <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>
    <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>
    <div class="text-area">
    <label>Skills:</label>
    <textarea rows="7" cols="40" class="input text_markitup" name="skills" id="skills" placeholder="Please mention your skills that you are having..."></textarea>
    </div>
    </div>
    <div>
    <label>Employment History:</label>
    <input type="text" class="input" name="emp_history" id="emp_history" value="">
    </div>  
<div>
<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>  




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

    </div>
   </div>
    <?php

        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