<? include_once("../includes/main.inc.php");

$headerTitleName = "Add New County Menu";



$page_id = $_REQUEST['page_id'];

//$country_id = '1';

$county_menu_name = addslashes($county_menu_name);

//$county_menu_id = addslashes($county_menu_id);

$county_menu_link = addslashes($county_menu_link);

$status = addslashes($status);



if(is_post_back()) {


if($page_id!='') {		 		

		$sql = "update `tbl_county_menu` set county_menu_name='".addslashes($county_menu_name)."', county_menu_link='".addslashes($county_menu_link)."',county_menu_heading='".addslashes($county_menu_heading)."',county_menu_content='".addslashes($county_menu_content)."',tittle='".addslashes($tittle)."',description='".addslashes($description)."',keyword='".addslashes($keyword)."' where id = '$page_id'";

		db_query($sql);

		
		set_session_msg("County Menu updated successfully.");	

	header("Location: county_menu.php?start=$start");

	exit;

	} else{/*	

	

		$sql = "insert into `tbl_county_menu` set county_menu_name='".addslashes($county_menu_name)."', status='".addslashes($status)."', county_menu_link='".addslashes($county_menu_link)."', county_menu_id='".addslashes($county_menu_id)."',county_menu_heading='".addslashes($county_menu_heading)."',county_menu_content='".addslashes($county_menu_content)."',tittle='".addslashes($tittle)."',description='".addslashes($description)."',keyword='".addslashes($keyword)."'";
		
		echo '<pre>'; print_r($sql);

		db_query($sql);

		set_session_msg("New County Menu added successfully.");

	 

	header("Location: county_menu.php?start=$start");

	exit;

	*/}

}



$page_id = $_REQUEST['page_id'];

if($page_id!='') {

 $sql = "select `tbl_county_menu`.* from `tbl_county_menu` left join `tbl_state` on `tbl_county_menu`.county_id=`tbl_state`.county_id left join `tbl_country` on `tbl_county_menu`.country_id=`tbl_country`.country_id where county_menu_id = '$page_id'";
	 $sql = "select * from `tbl_county_menu` where id = '$page_id'";

	$result = db_query($sql);

	if ($line_raw = mysql_fetch_array($result)) {

		$line_raw = ms_form_value($line_raw);

		@extract($line_raw);

	}

}

?>

<link href="styles.css" rel="stylesheet" type="text/css">



<? include("top.inc.php");?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td id="pageHead"><div id="txtPageHead">

       Update - County Details.</div></td>

  </tr>

</table>

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>

<table width="80%" align="left">

		  	<tr><td>

		  	<form method="post" action="" enctype="multipart/form-data" name="form1" id="form1" onSubmit="return validate(this);">

		  	
			<input type="hidden" name="hf1stateId" id="hf1stateId" value="<?php echo $state_id; ?>">

        <table width="80%" align="center" border=0 cellpadding="0"  cellspacing="0" class="text">

    	<tr>

		<td  colspan="2"height="30"  align="right"><a href="county_menu.php?start=<?=$start?>" class="redcolor"><strong>Back To County List</strong></a></td>

		</tr>    

        <tr><td height="15"><div align="center"><span class="msg"><?=display_sess_msg();?></span></div><br /></td></tr>  

		<tr>

		  <td class="lables"><b>State Name</b></td>

          <td class="feildstxt">

          	<select id="state_id" name="state_id">

          		<!--<option value="">&nbsp;&nbsp;&nbsp;Loading...&nbsp;&nbsp;&nbsp;</option>-->

                <?php

          		$sqls=mysql_query("select * from tbl_state where state_status=1 order by state_name ASC");

          		while($ress=mysql_fetch_array($sqls))

          		{

          			if($ress['state_id']==$state_id)

          			{

						echo "<option value='".$ress['state_id']."' selected>".$ress['state_name']."</option>";

					}

					else

					{

						echo "<option value='".$ress['state_id']."'>".$ress['state_name']."</option>";

					}

				}

          		?>

          	</select>

          </td>

        </tr>
        <tr><td>&nbsp;</td></tr> 

        

        <tr>

		  <td class="lables"><b>County Name</b></td>

          <td class="feildstxt"><input type="text" style="width:300px;" value="<?=stripslashes($ct_menu_name)?>" name="ct_menu_name" id="ct_menu_name" disabled="disabled"  /></td>

        </tr>

        <tr><td>&nbsp;</td></tr>
        

		<tr>

		  <td class="lables"><b>Status</b></td>

          <td class="feildstxt"><select name="county_status" id="county_status">

          <option value="1" <?php if($county_status=='1'){ echo 'selected="selected"'; } ?>>Active</option>

          <option value="0" <?php if($county_status=='0'){ echo 'selected="selected"'; } ?>>InActive</option>          

          </select></td>

        </tr>

        <tr><td>&nbsp;</td></tr>

       <tr>

		  <td class="lables" colspan="2"><hr/></td>

		 
          
		</tr>

        <tr><td>&nbsp;</td></tr>


		 <tr>

		  <td class="lables"><b>County Menu Name</b></td>

         <td class="feildstxt"><textarea style="width:300px;" name="county_menu_name" id="county_menu_name"  ><?=stripslashes($county_menu_name)?></textarea></td>


        </tr>

        <tr><td>&nbsp;</td></tr>
		
		 <tr>

		  <td class="lables"><b>County Menu Link</b></td>

          <td class="feildstxt"><textarea style="width:300px;" name="county_menu_link" id="county_menu_link"  ><?=stripslashes($county_menu_link)?></textarea></td>

        </tr>
		  <tr><td>&nbsp;</td></tr>
		
		<tr>
		  <td class="lables"><b>Tittle</b></td>
         <td class="feildstxt"><textarea style="width:300px;" name="tittle" id="state_menu_content"  ><?=stripslashes($tittle)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
		
		<tr>
		  <td class="lables"><b>Description</b></td>
         <td class="feildstxt"><textarea style="width:300px;" name="description" id="state_menu_content"  ><?=stripslashes($description)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
		
		<tr>
		  <td class="lables"><b>Keywoord</b></td>
         <td class="feildstxt"><textarea style="width:300px;" name="keyword" id="state_menu_content"  ><?=stripslashes($keyword)?></textarea></td>
        </tr>
      
		 <tr><td>&nbsp;</td></tr>
		
        <tr>
		  <td class="lables"><b>Menu Content Heading</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="county_menu_heading" id="county_menu_heading"  ><?=stripslashes($county_menu_heading)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Menu Content</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="county_menu_content" id="county_menu_content"  ><?=stripslashes($county_menu_content)?></textarea></td>
        </tr>
		
      
        <tr>

        <td align="left" class="lables">&nbsp;</td>

        <td align="left" class="feildstxt"><input class="button" type="submit" name="submit" value="Save"></td>

        </tr>

        <tr><td height="25">&nbsp;</td></tr>

   </table>

    </form>
	
	<?php //print($_POST); ?> 

    </td></tr></table>  

    <script>

    function getState()

	{

		$("#state_id").html('<option value="">&nbsp;&nbsp;&nbsp;Loading...&nbsp;&nbsp;&nbsp;</option>');

		$.post('get_state.php',{country_id:$("#country_id").val(),edit_state_id:$("#hfstateId").val()},function(data,status){

			if(status='success')

			{	

				$("#state_id").html(data);

			}

			else{

				alert("Something Going Error");	

			}

		});

	}

	// getState();

</script>  


<script type="text/javascript">
		 var oFCKeditor=new FCKeditor('county_menu_heading','625','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('county_menu_content','625','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>  
	

  <? include("bottom.inc.php");?>