<h3 align="center"><?php echo $heading ; ?></h3>

<div align="center" style="width:100%;">

<div class="err_msg" >
<?php 
echo validation_errors(); 
echo $str; 
?>
</div>

<div style="width:460px; height:auto; text-align:left;">

<form name="form1" method="post" action="" enctype="multipart/form-data">

<p>
<label>Order * </label><br>
<select name="slct"  style="width:100px;"  >
<option value="">-Select-</option>
<?php for($i=1;$i<=20;$i++): ?>
<option value="<?=$i?>" <?php if($i==$slct){echo "selected";}?> ><?php echo $i ; ?></option>
<?php endfor; ?>
</select>
</p>


<p>
<label>Title *</label><br>
<input type="text" name="title" style="width:450px;" value="<?php echo $title ; ?>" />
</p>


<p>
<label>Text *</label><br />
<textarea name="text" cols="50" rows="12" onblur="return blank(this)" id="elm3"><?php echo $text ; ?></textarea>
</p>


<p>
<label>service Category *</label><br />
<div style="float:left; width:50px; margin-right:5px;">
<select name="pcid" id="pcid" style="width:360px;" size="5" multiple="multiple">
<?php
foreach($category_result as $row):
?>
<option value="<?=$row['pcid']?>" ><?php echo $row['title'] ; ?></option>
<?php endforeach; ?>
</select>
<input type="button" value="Add" style="width:80px" name="add" onclick="return moveOptions(pcid, b),filled()"/>
</div>

<div style="float:right; width:50px;">
<select name="selcstid[]" id="b" multiple="multiple" style="width:290px;" size="5" class="reg_input">	
<?php
/*fix part to display values if any error occurs*/
if($this->input->post('submit') && $this->input->post('selcstid'))
//if( isset($_POST['submit']) && isset($_POST['selcstid']) )
{
	  
  foreach($_POST['selcstid'] as $aid):
  echo '<option value="'.$aid.'">'.get_field_from_id('title','category','pcid',$aid).'</option>';
  endforeach;

}/*end of fix part*/
else
{
$query = "select * from `catpref` where `aid`='$aid' order by `pcat` asc";
$resultset = mysql_query($query);
while($row = mysql_fetch_array($resultset))
{
?>	
<option value="<?=$row['pcat']?>"><?php echo get_field_from_id('title','category','pcid',$row['pcat']) ; ?></option><?php 
}
}
?>	
</select>
<input type="button" value="Remove" style="width:80px" name="remove" onClick="deleteOption(b)"/> 
</div>

</p>

<br />
<p>
<label>Image ( 250x250, Only jpeg, gif. Maxsize 500 Kb)</label><br/>
<input type="file" name="img"/>&nbsp;&nbsp;&nbsp;
<?php if($img!=''){?>

<img src="<?php echo base_url('assets/images/'.$img) ;?>" width="70" height="70" border="0" />
<a href="<?php echo site_url($type.'_admin/image_delete/'.$aid.'/1/') ; ?>" onClick="return confirm('Delete image ?')">
<img src="<?php echo base_url('assets/web_images/delete.gif') ; ?>" width="20" height="20" />
</a> 
<?php } ?>
</p>


<p>
<input name="submit" class="button-primary" value="Submit" type="submit" style="float:right;">
</p>

</form>

</div>

</div>

<p>&nbsp;</p>