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

$headerTitleName = "Add New State Menu";



$page_id = $_REQUEST['page_id'];

$id = $_REQUEST['id'];

$state_menu_name = addslashes($state_menu_name);

$state_menu_link = addslashes($state_menu_link);

$state_menu_id = addslashes($state_menu_id);


if(is_post_back()) {
                     $qs= explode("_", $state_menu_id );
			         $qs1 =$qs[0];
			         $qs2 =$qs[1];

	if($page_id!='') {		 
                      
		

		$sql = "update `tbl_state_menu` set state_menu_name='".stripslashes($state_menu_name)."', state_menu_link='".addslashes($state_menu_link)."',state_menu_id='".addslashes($qs1)."', st_menu_name='".addslashes($qs2)."',state_menu_heading='".addslashes($state_menu_heading)."',state_menu_content='".addslashes($state_menu_content)."',tittle='".addslashes($tittle)."',description='".addslashes($description)."',keyword='".addslashes($keyword)."' where id = '$page_id'";

		db_query($sql);

set_session_msg("State Menu updated successfully.");	

    } 
	else
	{	

	  
		$sql1 = "insert into `tbl_state_menu` set state_menu_name='".stripslashes($state_menu_name)."', status='".addslashes($status)."', state_menu_link='".addslashes($state_menu_link)."',state_menu_id='".addslashes($qs1)."', st_menu_name='".addslashes($qs2)."',state_menu_heading='".addslashes($state_menu_heading)."',state_menu_content='".addslashes($state_menu_content)."',tittle='".addslashes($tittle)."',description='".addslashes($description)."',keyword='".addslashes($keyword)."'";
		
		 echo "<pre>", print_r($_REQUEST, true);
   db_query($sql1);

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



	}

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

	exit;

}



$page_id = $_REQUEST['page_id'];

if($page_id!='') {

	/*$sql = "select `tbl_state_menu`.*,`tbl_country`.country_name,`tbl_state_menu`.state_status,`tbl_state_menu`.country_id from `tbl_state_menu` join `tbl_country` on `tbl_state_menu`.country_id=`tbl_country`.country_id where state_id = '$page_id'";*/
	//$sql = "select * from `tbl_state_menu` where id = '$page_id'";
	
	//echo "<pre>", print_r($_REQUEST, true);

	//$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">

       Add/Edit State Menu</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);">

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

    	<tr>

		<td  colspan="2"height="30"  align="right"><a href="state_menu.php?start=<?=$start?>" class="redcolor"><strong>Back To State Menu 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>&nbsp;</td></tr>

        

          </td>

       

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

		  <td class="lables"><b>State Menu Id</b></td>

          <td class="feildstxt">

          	<select id="state_menu_id" name="state_menu_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']."_".$ress['state_name']."' selected>".$ress['state_name']."</option>";
						
					
					}

					else

					{

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

					}

				}

          		?>

          	</select>

          </td>

        </tr>

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

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

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

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

          <option value="0" <?php if($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>State Menu Name</b></td>

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

        </tr>

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

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

          <td class="feildstxt"><textarea style="width:300px;" name="state_menu_link" id="state_menu_link"  ><?=stripslashes($state_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="tittle"  ><?=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="description"  ><?=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="keyword"  ><?=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="state_menu_heading" id="state_menu_heading"  ><?=stripslashes($state_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="state_menu_content" id="state_menu_content"  ><?=stripslashes($state_menu_content)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</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>
    </td></tr></table>   
	
	 <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('state_menu_heading','625','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('state_menu_content','625','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
	
   

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