<?php

include("session_start.php");

include("session_check.php");

include("database.php");

$query="select * from master_tab";

$rest=mysql_query($query)or die(mysql_error());

$num = mysql_num_rows($rest);

extract($_GET);

		

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

	{

		$instrument = $_POST['instrument'];

		//echo $instrument;

		$mac = $_POST['mac'];

		//echo $mac;

		

		//for($i=1;$i<=3;$i++)

		//{

		 //$x=$_POST["tree_name"."$i"];

		extract($_POST);

		

		$instrument = $instrument;

		//echo $instrument;

		$mac = $mac;

		//echo $mac;

		

		

		

		

		$sql = "insert into super_admin(company_name,company_addr,complete_name,user_name,password,email_id,phone1,phone2)values('$cname','$add','$name','$user_name','$pass','$email_id','$p1','$p2')";

		$result = mysql_query($sql);

		$sql_id = mysql_insert_id();

		

		echo $select_row['super_id'];

		for($i=0;$i<$instrument;$i++)

		{		

			

			$imei = "insert into imei_details(imei_no,super_id)values('".$_POST["myimei"."$i"]."','$sql_id')";

			

			$imei_result = mysql_query($imei);

		}

		

    	for($j=0;$j<$mac;$j++)

		{		

			echo $mac;

			$mac_insert = "insert into mac_details(mac_no,super_id)values('".$_POST["mymac"."$j"]."','$sql_id')";

			$mac_result = mysql_query($mac_insert);

		}

		//exit;

		if($result)

		{ ?>

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

				alert("Inserted 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>

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

function more_details()

{

	document.getElementById("more").style.display='block';

	document.getElementById("more1").style.display='block';

}



function add_details_instrument()

{

	var instrument = document.getElementById("instrument");

	var mac = document.getElementById("mac");

	

	var instrument_no = document.super_admin.instrument.value;

	for (var i=0; i<instrument_no;i++)

	{

		

		imei.innerHTML = imei.innerHTML +"<br>Enter IMEI Number of Tab : <input type='text' name='myimei"+i+"'id='myimei"+i+"'><br>";

		

	}

}

	

function add_details_mac()

{

	var instrument = document.getElementById("instrument");

	//var mac1 = document.getElementById("mac");

	//alert( "hi");

	var mac_no = document.super_admin.mac.value;

	for (var i=0; i<mac_no;i++)

	{

		

		mac_div.innerHTML = mac_div.innerHTML +"<br>Enter MAC ID of Computer : <input type='text' name='mymac"+i+"'id='mymac"+i+"'><br>";



			

	}

	

}

</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="super_admin" method="post" action="" >

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

		<tr>

			<td bgcolor="#a9c1de" class="f"> Insert Details For New Company User </td>

		</tr>

        <tr>

        	<td>

            	<table align="center" width="90%">

                <tr>

                	<td> <br /></td>

                </tr>

                <br>

                	<div align="left"> <font color="#FF0000" face="Verdana" size="2"> * Items marked with an asterisk (*) are required </font>  </div>

                <tr>

        			<td>

						<table border="1" cellpadding="2" cellspacing="2" width="100%" align="center" bordercolor="#bcd5e7" bgcolor="#f4f8fb">

						<tr>

    						<td colspan="3" align="center" ><font class="font4"><b>Insert Details For New Company User</b> </font></td>

  						</tr>

						<tr>

							<td>

                    			<table  align="center" style="margin-top:20" border="0">

                                

            					<tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Company Name :</b></font> </td>

    								<td><input type="text" name="cname" id="cname" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td><font class="font4"><b>Company Address:</b></font> </td>

    								<td><textarea name="add" id="add" cols="39" rows="3" ></textarea></td>

    							</tr>

                                <tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Complete Name :</b></font> </td>

    								<td><input type="text" name="name" id="name" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Username :</b></font> </td>

    								<td><input type="text" name="user_name" id="user_name" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Password :</b></font> </td>

    								<td><input type="password" name="pass" id="pass" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Email Id :</b></font> </td>

    								<td><input type="text" name="email_id" id="email_id" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td ><font class="font4"><b> <font color="#FF0000" > * </font> Phone 1 :</b></font> </td>

    								<td><input type="text" name="p1" id="p1" maxlength="10" size="50dp" /></td>

    							</tr>

                                <tr>

    								<td><font class="font4"><b>Phone 2 :</b></font> </td>

    								<td><input type="text" name="p2" id="p2" size="50dp" /></td>

    							</tr>

                                <tr> <td> <br> </td> </tr>

                                

                                <tr>

                                	<td> </td>

                                    <td align="right"><font class="font4">

                                    	<a href='#' onClick="more_details()"> Add IMEI and MAC Number Details </a>

                                    </td>

                                </tr>

                                <tr> <td> <br> </td> </tr>

                                </table>

                                <table align="center">

                                    <tr>

                                    

                                        <td><font class="font4"><b>

                                        <div  id="more" style="display:none">

                                            <font color="#FF0000" > * </font> Enter Number of Instruments : <input type="text" id="instrument" name="instrument" size="10">

                                           

                                         <input type="button" id="add_instrument" name="add_instrument" value="Add+" onClick="add_details_instrument();" >

                                         

                                            

                                        </div>

                                        </td>

                                        

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

                                        

                                        <td valign="top"><font class="font4"><b>

                                        <div  id="more1" style="display:none">

                                            <font color="#FF0000" > * </font> Enter Number of Machines : <input type="text" id="mac" name="mac" size="10">

                                             <input type="button" id="add_mac" name="add_mac" value="Add+" onClick="add_details_mac();">

                                        </div>

                                        </td>

                                    </tr>

                                    

                                    <tr> 

                                        <td valign="top"> <font class="font4"><b><div  id="imei"> </div> </td>

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

                                        <td valign="top"> <font class="font4"><b><div  id="mac_div"> </div> </td>

                                    </tr>

                                

    							</table>

                    		</td>

        				</tr>

    					

						</table>

            		</td>

				</tr>

                

        		</table>

            </td>

        </tr>

		

	</table>

    <br />

    <table border="1" align="center" width="80%"  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" name="back" id="back" value="Back" style="text-decoration:none" 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>