     <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Channellimo
            <small>Preview</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">Post</li>
          </ol>
        </section>
        
        <section class="content">
        	<div class="col-lg-12">
             <?php echo validation_errors('<div class="error">', '</div>'); ?>
             <form action="" method="post">
             	<div class="box box-primary col-lg-8">
                	<div class="box-header with-border">
						<h3 class="box-title">FORM EDIT</h3>
					</div>
                    
                    <div class="form-group">
                        <label>Code</label>
                        <?php 
							if(empty($post->postCode) OR $post->postCode == 0 )
							{
								$mycode = random_string('nozero', 8).date('d');
							}
							else
							{
								$mycode = $post->postCode;
							}
						?>
                         <input class="form-control" name="code" id="code" value="<?php echo $mycode;?>" readonly>
                    </div>
                                    
                    <div class="form-group">
                         <label>Title</label>
                         <input class="form-control" name="title" id="title" value="<?php echo $post->postTitle;?>">
                    </div>
                                   
                    <div class="form-group">
                        <label>Description</label>
                        <textarea class="form-control ckeditor" rows="3" name="desc" id="desc"><?php echo $post->postDesc;?></textarea>
                    </div>
                    
                    <?php 
					if($post->postID!=1){
					?>              
                    <div class="form-group">
                        <label for="status">Status</label>
                        <div class="col-lg-12">
                        <input type="radio" name="status" class="flat-red" value="1" <?php echo $post->postStatus == 1 ? 'checked' : '' ?>>
                         Active 
                        <input type="radio" name="status" class="flat-red" value="0" <?php echo $post->postStatus == 0 ? 'checked' : '' ?>>
                        Not Active
                        </div> 
                    </div>

                    <?php //echo $authorize == 'active' ? 'checked' : '' ?>
                    
                    <div class="form-group">
                       <label>Category</label>
			  			<?php
							$checked = NULL;
                            $stmt1 = $this->db->query("SELECT * FROM `blog_cats` WHERE `catStatus`=1 order by catTitle");
                            foreach($stmt1->result() as $data)
                            {
											 
								$stmt2 = $this->db->query('SELECT catID FROM blog_post_cats WHERE catID = '.$data->catID.' AND postID = '.$post->postID.'') ;
								$row = $stmt2->row();
								if(isset($row->catID) == isset($data->catID)){
									$checked = 'checked=checked';
								} else {
									$checked = null;
								}
						?>
                                       
                        <div class="checkbox">
                        <label><input type="checkbox" name="catID[]" value="<?php echo $data->catID;?>" <?php echo $checked ?> ><?php echo $data->catTitle;?></label> 
                        </div> 
                        <?php	
                           }
                        ?>
                     </div>
					<?php }?>
       
                    <div class="form-group">
                     <input type="submit" name="update_post" value="Update" class="btn btn-primary"/> 
                     <button type="reset" class="btn btn-danger">Reset</button>
                    </div>
                    
                    
                </div>
             </form>
            </div>
        </section>
     </div>
     <script src="<?php echo base_url('assets/ckeditor/ckeditor.js');?>"></script>
     <?php if($msg = $this->session->flashdata("message")): ?>
     <script>
     	alert("<?php echo $msg?>");
     </script>
     <?php endif; ?>