<div class="row-fluid">

<form class="form-horizontal well" action="<?php echo base_url();?>postad/edit" method="POST" enctype="multipart/form-data" id="postadform">
        <fieldset><div class="span6">
          <legend>Edit your Ad</legend>
            <div class="control-group">
            <label for="select01" class="control-label">Category : </label>
            <div class="controls">
              <select id="category" name="category">
		<?php 
				
		foreach($parent_categories as $category) { 
			$selected=null;
			if($category->id==$details->category_id){ $selected='selected="selected"';}
		?>
			 <option value="<?php echo $category->id;?>" <?php echo $selected;?>><?php echo $category->name;?></option>
			<?php 
				
			if($this->categories_model->hasSubcategory($category->id) > 0 ){ 
				foreach($this->categories_model->getSubCategories($category->id) as $subcategory) { 
			if($subcategory->id==$details->category_id){ $selected='selected="selected"';}
			?>
					
					<option value="<?php echo $subcategory->id;?>" <?php echo $selected;?>><?php echo '&nbsp;&nbsp;'.$subcategory->name;?></option>
				<?php }
			 } ?>
		<?php } ?>
               
               
              </select>
            </div>
          </div>
          
	<div class="control-group">
            <label for="input01" class="control-label">Ad Title : </label>
            <div class="controls">
              <input type="text" id="title" name="title" class="input-xlarge" value="<?php echo $details->title;?>">
              <p class="help-block">Ex: Heavy Discount on automobiles </p>
            </div>
          </div>
          <div class="control-group">
            <label for="textarea" class="control-label">Ad Description : </label>
            <div class="controls">
              <textarea rows="3" id="description" name="description" class="input-xlarge"><?php echo $details->description;?></textarea>
            </div>
          </div>
	<div class="control-group">
            <label for="input01" class="control-label">Price / Discounted Price :</label>
            <div class="controls">
              <input type="text" id="price" name="price" class="input-xlarge" value="<?php echo $details->price;?>">
             
            </div>
          </div>
           <div class="control-group">
            <label for="fileInput" class="control-label">Contact No : </label>
            <div class="controls">
              <input type="text" id="contact" name="contact" class="input-xlarge" value="<?php echo $details->phone;?>">
            </div>
          </div>
	<!--<div class="control-group">
            <label for="fileInput" class="control-label">Image : </label>
            <div class="controls">
              <input type="file" id="filename" name="filename" class="input-file">
            </div>
          </div>-->
	
	<input type="hidden" name="user_id" value="<?php echo $this->session->userdata('user_id');?>"/>
	<input type="hidden" name="posting_id" value="<?php echo $details->id;?>"/>
	
          <div class="form-actions">
            <button class="btn btn-primary" type="submit">Update</button>
            <button class="btn" type="reset">Cancel</button>
          </div>
        </div><div class="span6">
            <legend>Ad Images</legend>
             <div class="control-group">
            <label class="control-label" for="fileInput">Image 1:</label>
            <div class="controls">
              <input class="input-file" id="adimage1" name="adimage1" type="file">
            </div>
          </div>
            <div class="control-group">
            <label class="control-label" for="fileInput">Image 2:</label>
            <div class="controls">
              <input class="input-file" id="adimage2" name="adimage2" type="file">
            </div>
          </div>
            <div class="control-group">
            <label class="control-label" for="fileInput">Image 3:</label>
            <div class="controls">
              <input class="input-file" id="adimage3" name="adimage3" type="file">
            </div>
          </div>
            <div class="control-group">
            <label class="control-label" for="fileInput">Image 4:</label>
            <div class="controls">
              <input class="input-file" id="adimage4" name="adimage4" type="file">
            </div>
          </div>
            <div class="control-group">
            <label class="control-label" for="fileInput">Image 5:</label>
            <div class="controls">
              <input class="input-file" id="adimage5" name="adimage5" type="file">
            </div>
          </div>
        </div>
        </fieldset>
      </form>

    </div>