<script>
    function readURL(input, objID) {
        var node = document.createElement("img");
        var parentDIV = document.getElementById("image");
        parentDIV.appendChild(node);
        document.getElementById("image").appendChild(node);
        node.setAttribute("id", objID);
        node.setAttribute("src", "");
        
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function(e) {
                $('#' + objID)
                        .attr('src', e.target.result)
                        .width(50)
                        .height(50);
            };
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h1 class="page-header">Add User Form</h1>
    <div class="">
        <a href="<?php echo base_url(); ?>super_admin">Dashboard</a>
        <span>Add <?php // echo $user_role; ?> User</span>
    </div>
    <h2 class="sub-header">Section title</h2>
    <p>
        <?php
        $message = $this->session->userdata('message');
        $this->session->unset_userdata('message');
        if ($message) {
            echo $message;
        }
        ?>
    </p>
    <div class="table-responsive col-sm-12">
<?php  echo validation_errors(); ?>
        <form action="<?php echo base_url(); ?>super_admin/add_user" method="post" name="user" enctype="multipart/form-data" >
            <div class="form-group col-sm-6" >
                <label for="import_file" style="float:left;">Select CSV File</label><span class="required"> * <?php // echo form_error('user_image'); ?></span><br><br>
                <input style="float:left;" type='file' onchange="readURL(this, 'file_0');" name="user_image" value="<?php // echo set_value('user_image'); ?>"/>
                <div id="file" style="float:left;width: 50px; height: 50px;" ></div>
            </div>
            <div class="checkbox col-sm-6" >
                <button type="submit" class="btn btn-default">Submit</button>
            </div>
        </form>
    </div>
</div>