<?php

include("session_start.php");

include("session_check.php");

include("database.php");  

extract($_GET);

if($_GET['id']!="")

	{

		$query="select * from super_admin where super_id='$id'";

		$result=mysql_query($query);

		$row=mysql_fetch_assoc($result);

		$query1="select * from imei_details where imei_id='$id'";

		$rest1=mysql_query($query1);

	}

if($_POST['submit']!="")

{

		//extract($_POST);

		//$query=mysql_query("update info set tree_name='$tree_name' where aid='$id'");

		$company_name=$_POST["company_name"];

		$company_addr=$_POST["company_addr"];

		$complete_name=$_POST["complete_name"];

		$user_name=$_POST["user_name"];

		$password=$_POST["password"];

		$email_id=$_POST["email_id"];

		$phone1=$_POST["phone1"];

		$phone2=$_POST["phone2"];

		

		

		mysql_query("update super_admin SET company_name='$company_name',company_addr='$company_addr',complete_name='$complete_name',user_name='$user_name',password='$password',email_id='$email_id',phone1='$phone1',phone2='$phone2' where super_id='$id'");

		

		echo "update super_admin SET company_name='$company_name',company_addr='$company_addr',complete_name='$complete_name',user_name='$user_name',password='$password',email_id='$email_id',phone1='$phone1',phone2='$phone2' where super_id='$id'"; 

		

		for($i=1;$i<=20;$i++)

		{



		   	$imei_no=$_POST["imei_no"."$i"];

		 	$mac_no = $_POST["mac_no"."$i"];

		 	$row_id_imei=$_POST["row_id_imei"."$i"];

		 

			if($imei_no!="")

			{

				mysql_query("update imei_details SET imei_no='$imei_no' where imei_id='$row_id_imei'");

				echo "update imei_details SET imei_no='$imei_no' where imei_id='$row_id_imei'";

			}

		}

		for($j=1;$j<=20;$j++)

		{



		   	$imei_no=$_POST["imei_no"."$j"];

		 	$mac_no = $_POST["mac_no"."$j"];

			$row_id_mac=$_POST["row_id_mac"."$j"];

		 

			if($mac_no!="")

			{

				mysql_query("update mac_details SET mac_no='$mac_no' where mac_id='$row_id_mac'");

				echo "update mac_details SET mac_no='$mac_no' where mac_id='$row_id_mac'";

			}

		}

		?>

        <script language="javascript" type="text/javascript">

		alert("Updated Successfully");

		window.location="super_admin_grid.php";

		</script>

<?php

}

?>



<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Survey Application</title>

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

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

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

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

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

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

</script>



<script type="text/javascript">



ddsmoothmenu.init({

	mainmenuid: "smoothmenu1", //menu DIV id

	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"

	classname: 'ddsmoothmenu', //class added to menu's outer DIV

	//customtheme: ["#1c5a80", "#18374a"],

	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]

})







</script>

</head>



<body class="body">



<div id="wrap" >

  

  

  <div id="top">

    <?php include("header.php"); ?>

    <!--<div id="ban"><table width="1004" align="left"  >

  <tr>

    <td width="234"  align="left"  valign="top" ><img src="images/logoss.jpg" border="0" /></td>

    <td  valign="top" style="padding-top:5px;" width="758"  align="right" ><table align="left" width="707">

  <tr>

    <td width="386" align="left"><div ><a href="#" id="bantext1">REQUEST A DEMO</a></div></td>

    <td width="167" align="left"><div ><a href="#" id="bantext2">DOWNLOADS</a></div></td>

    <td width="138" align="left"><div ><a href="#" id="bantext2">DOWNLOADS</a></div></td>

  </tr>

  <tr>

    <td colspan="3" align="center" class="banquot">Be Smart and Survey Smartly </td>

  </tr>

</table></td>

    

    

  </tr>

</table>

    </div>-->

    

    </div>

    </div>

   <div id="menuholder"><?php include("adminmenu.php"); ?></div>

   <div id="contholder">

   

    

    <!--<div id="nav">

     <ul>

     <li><a href="adminhome.php" id="home_on">HOME</a></li>

        <li><a href="adminproducts.php" id="products_on">PRODUCTS</a></li>

		<li><a href="adminfeatures.php" id="features_on">FEATURES</a></li>

        <li><a href="adminadvantages.php" id="advantages_on">ADVANTAGES</a></li>

        <li><a href="adminhowitworks.php" id="howitworks_on">HOW IT WORKS</a></li>

        <li><a href="adminhelp.php" id="help_on">HELP</a></li>

        <li><a href="admincontactus.php" id="contactus_on">CONTACT US</a></li>

    

    </ul>

    

    </div>-->

    

    

    	<div id="contdata">

   <?php //include("header.php"); ?><br />

	<form name="edit" method="post">

    

    	<table border="1"  align="center" width="60%" height="200px" bordercolor="#2a4a73">

        	<tr>

                <td bgcolor="#a9c1de" class="f"> Edit Details </td>

             </tr>

             <tr>

            	<td>  

                	<table width="80%" align="center" height="130px" bgcolor="#f4f8fb">

                    	<tr> 

                        		<br />	

                        </tr>

                    	<tr>

                        	<td bgcolor="#c1d2e8" class="f" colspan="2" align="center" > Area Information </td>

                        </tr>

                        <tr> 

                        		<td>&nbsp; </td>	

                        </tr>

                        <tr>

            				<td class="c"> Company Name </td>

                    		<td> <input type="text" name="company_name" id="company_name" value="<?php echo $row['company_name']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Company Address </td>

                    		<td> <input type="text" name="company_addr" id="company_addr" value="<?php echo $row['company_addr']; ?>"></td>

            			</tr>

                        <tr>

            				<td class="c"> Complete Name</td>

                    		<td> <input type="text" name="complete_name" id="complete_name" value="<?php echo $row['complete_name']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Username</td>

                    		<td> <input type="text" name="username" id="username" value="<?php echo $row['user_name']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Password </td>

                    		<td> <input type="text" name="password" id="password" value="<?php echo $row['password']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Email ID </td>

                    		<td> <input type="text" name="email_id" id="email_id" value="<?php echo $row['email_id']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Phone1 </td>

                    		<td> <input type="text" name="phone1" id="phone1" value="<?php echo $row['phone1']; ?>"> </td>

            			</tr>

                        <tr>

            				<td class="c"> Phone2 </td>

                    		<td> <input type="text" name="phone2" id="phone2" value="<?php echo $row['phone2']; ?>"> </td>

            			</tr>

                        

                        <tr> 

                        		<td>&nbsp; </td>	

                        </tr>

                        <tr>

                        	<td bgcolor="#c1d2e8" class="f" colspan="2" align="center"> IMEI and MAC Number Details </td>

                        </tr>

                        <tr> 

                        		<td>&nbsp; </td>	

                        </tr>

                        <tr>

                        	<table border="0" width="80%" align="center" height="10px" bgcolor="#f4f8fb" bordercolor="#2a4a73">

                        		<tr>

                    				<td class="c" align="center"> IMEI Number </td>

                        			<td class="c" align="center"> mac Number </td>

                                </tr>

                              	

								<tr>

                                

                                        <?php

											$i=1;

											

											$restq=mysql_query("select * from imei_details where super_id='".$_GET['id']."'");

											//echo "select * from imei_details where super_id='".$_GET['id']."'";

											$num=mysql_num_rows($restq);

											$mac_query = mysql_query("select * from mac_details where super_id='".$_GET['id']."'");	

											$num1=mysql_num_rows($mac_query);										

										?>

                                        

											<td valign="top" align="center"> 

                                            <table>

                                            <?php while($num!=0)

											{

												$rowq=mysql_fetch_array($restq);

											?>

                                            <tr>

                                            <td class="font4"><?php echo $i."."?>

                                            <input type="text" size="8" name="imei_no<?php echo $i; ?>" value="<?php echo $rowq['imei_no']; ?>"> 

                                            </td>

                                            </tr>

                                           

										

                                        	<input type="hidden" name="row_id_imei<?php echo $i; ?>" value="<?php echo $rowq['imei_id']; ?>"/>

                               <?php

							   					$i++;										

												$num--;

											}

							  ?>

                              </table>

                              </td>

                              

                              <td valign="top" align="center"> 

                                            <table>

                                            <?php 

											$i=1;

											while($num1!=0)

											{

												

												$row_mac=mysql_fetch_array($mac_query);

											?>

                                            <tr>

                                            <td class="font4"><?php echo $i."."?>

                                            <input type="text" size="8" name="mac_no<?php echo $i; ?>" value="<?php echo $row_mac['mac_no']; ?>"> 

                                            </td>

                                            </tr>

                                           

										

                                        	<input type="hidden" name="row_id_mac<?php echo $i; ?>" value="<?php echo $row_mac['mac_id']; ?>"/>

                               <?php

							   					$i++;										

												$num1--;

											}

							  ?>

                              </table>

                              

                              </td>

                              

                              </tr>

                            </table>

                    	</tr>

                       

                    </table>

                </td>

            </tr>

        </table>

        <br />

        <table border="1"  align="center" width="60%"  bordercolor="#2a4a73">

        	<tr>

            	<td bgcolor="#a9c1de" class="f"align="right"><input type="submit"  name="submit" id="submit" value="Submit" onClick="return validate(); " style="text-decoration:none" class="button_c"><a href="super_admin_grid.php " style="text-decoration:none"><input type="button" value = "Back" class="button_c" /></a></td>

                </tr>

        </table>

    </form>

		

	<?php include("footer.php"); ?>	

    

   </div>

    



    	

   </div> 



<!--<div id="footer">Copyright © 2012.Smart Survey All Rights Reserved.Website Designed & Developed by Kalpak Solutions</div>-->











</body>

</html>