<form class="form-horizontal well" action="<?php echo base_url();?>postad/newad" method="POST" enctype="multipart/form-data" id="postadform">
        <fieldset>
          <legend>Post Your Ad</legend>
          <!--<div class="control-group">
            <label for="input01" class="control-label">Text input</label>
            <div class="controls">
              <input type="text" id="input01" class="input-xlarge">
              <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
            </div>
          </div>
          <div class="control-group">
            <label for="optionsCheckbox" class="control-label">Checkbox</label>
            <div class="controls">
              <label class="checkbox">
                <input type="checkbox" value="option1" id="optionsCheckbox">
                Option one is this and that&mdash;be sure to include why it's great
              </label>
            </div>
          </div>-->
          <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) { ?>
			 <option value="<?php echo $category->id;?>"><?php echo $category->name;?></option>
			<?php if($this->categories_model->hasSubcategory($category->id) > 0 ){ 
				foreach($this->categories_model->getSubCategories($category->id) as $subcategory) { ?>
					<option value="<?php echo $subcategory->id;?>"><?php echo '&nbsp;&nbsp;'.$subcategory->name;?></option>
				<?php }
			 } ?>
		<?php } ?>
               
               
              </select>
            </div>
          </div>
          <div class="control-group">
            <label for="select01" class="control-label">Ad Type : </label>
            <div class="controls">
                <select id="adtype" name="adtype">
                    <option value="1">Sell</option> <option value="2">Sevice</option>
                </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">
              <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"></textarea>
            </div>
          </div>
	<div class="control-group" id="pricefield">
            <label for="input01" class="control-label">Price / Discounted Price :</label>
            <div class="controls">
              <input type="text" id="price" name="price" class="input-xlarge">
             
            </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>
	  <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 $contact;?>">
            </div>
          </div>
         <?php if(!$this->session->userdata('is_login') && !$this->session->userdata('user_id')){?>
	<hr/>
	<input type="hidden" name="user_id" value="0"/>
	<div class="control-group">
            <label for="fileInput" class="control-label">Your Name : </label>
            <div class="controls">
              <input type="text" id="name" name="name" class="input-xlarge">
            </div>
          </div>
	<div class="control-group">
            <label for="fileInput" class="control-label">Your Email : </label>
            <div class="controls">
              <input type="text" id="email" name="email" class="input-xlarge">
            </div>
          </div>
        
	 <?php }else{ ?>
	<input type="hidden" name="user_id" value="<?php echo $this->session->userdata('user_id');?>"/>
	<?php } ?>
	<div class="control-group">
            
            
          </div>
          <div class="form-actions">
            <button class="btn btn-primary" type="submit">Submit</button>
            <button class="btn" type="reset">Cancel</button>
          </div>
        </fieldset>
      </form>
