<? include ("../settings.php"); ?>
<? include ("session.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Spark Planners Admin Panel</title>
	<meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="robots" content="noindex, nofollow" />
	
    <link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
	<link rel="Stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.7.1.custom.css"  />	
	<!--[if IE 7]><link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection" /><![endif]-->
	<!--[if IE 6]><link rel="stylesheet" href="css/ie6.css" type="text/css" media="screen, projection" /><![endif]-->
	<link rel="stylesheet" type="text/css" href="markitup/skins/markitup/style.css" />
	<link rel="stylesheet" type="text/css" href="markitup/sets/default/style.css" />
	<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen">
	<link rel="stylesheet" type="text/css" href="css/thickbox.css" media="screen" />
	<!--[if IE]>
		<style type="text/css">
		  .clearfix {
		    zoom: 1;     /* triggers hasLayout */
		    display: block;     /* resets display for IE/Win */
		    }  /* Only IE can see inside the conditional comment
		    and read this CSS rule. Don't ever use a normal HTML
		    comment inside the CC or it will close prematurely. */
		</style>
	<![endif]-->
	<!-- JavaScript -->
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.7.1.custom.min.js"></script>
	<script type="text/javascript" src="js/hoverIntent.js"></script>
	<script type="text/javascript" src="js/superfish.js"></script>
	<script type="text/javascript" src="js/thickbox-compressed.js"></script>
	<script type="text/javascript" src="js/livevalidation_standalone.compressed.js"></script>
	<script type="text/javascript">
		// initialise plugins
		jQuery(function(){
			jQuery('ul.sf-menu').superfish();
		});
	</script>
	<script type="text/javascript" src="js/excanvas.pack.js"></script>
	<script type="text/javascript" src="js/jquery.flot.pack.js"></script>
    <script type="text/javascript" src="markitup/jquery.markitup.pack.js"></script>
	<script type="text/javascript" src="markitup/sets/default/set.js"></script>
  	<script type="text/javascript" src="js/custom2.js"></script>
	<script type="text/javascript" src="js/modernizr.input.required.js"></script>
	

	 <!--[if IE]><script language="javascript" type="text/javascript" src="excanvas.pack.js"></script><![endif]-->

<script>
	( function($) {} ) ( jQuery );		
</script>
</head>
<body>
<?
	if (isset($_REQUEST['confirm'])){
				
		$SQL = "INSERT INTO tbl_registrant (
		registrant_salutation,
		registrant_family_name,
		registrant_first_name,
		registrant_badge_name,
		registrant_organisation,
		registrant_designation,
		registrant_email,
		registrant_contact,
		registrant_industry,
		registrant_industry_others,
		registrant_query,
		registrant_followup1,
		registrant_followup2,
		registrant_followup3,
		registrant_followup4,
		registrant_followup5,
		source_id,
		role_id
		) VALUES (
		'".$_REQUEST['salutation']."',
		'".$_REQUEST['familyname']."',
		'".$_REQUEST['fullname']."',
		'".$_REQUEST['badgename']."',
		'".$_REQUEST['organisation']."',
		'".$_REQUEST['designation']."',
		'".$_REQUEST['email']."',
		'".$_REQUEST['contact']."',
		'".$_REQUEST['industry']."',
		'".$_REQUEST['otherindustry']."',
		'".$_REQUEST['query']."',
		'".$_REQUEST['followup1']."',
		'".$_REQUEST['followup2']."',
		'".$_REQUEST['followup3']."',
		'".$_REQUEST['followup4']."',
		'".$_REQUEST['followup5']."',
		'".$_REQUEST['source_id']."',
		'13')";	
		$qry->queryExecute($SQL);
		
		$id = mysql_insert_id();
		$SQL = "SELECT id_itself FROM tbl_id ;";
		$result = $qry->querySelectSingle($SQL);
		$sn = $result['id_itself'];
		$new_id="W".str_pad($sn, 3, "0", STR_PAD_LEFT);
		$SQL = "UPDATE tbl_registrant SET registrant_sn='$new_id',registrant_number='$sn' WHERE registrant_id='$id';";
		// Update the SN
		$qry->queryExecute($SQL);
		$SQL = "UPDATE tbl_id SET id_itself=id_itself+1;";
		$qry->queryExecute($SQL);
		echo "<script>alert('Delegate ID is $new_id.');parent.thickBoxDone();</script>";
	}
?>
<form name="register_new" method='POST' action="">
<div class="container" id="container">
	<div  id="header">
    	<div id="profile_info">
			<img src="img/avatar.jpg" id="avatar" alt="avatar" />
			<p>Welcome</p>
			<p><strong><?=$_SESSION['user_email'];?></strong>. <a href="logout.php">Log out?</a></p>
		</div>
		<div id="logo"><h1><a href="/">AdmintTheme</a></h1></div>
		
	</div><!-- end header -->
	    <div id="content" >
			<? include ("nav_menu.php"); ?>
	    </div>
		<div id="tabledata" class="section">
			<h2 class="ico_mug">Walk-In Delegate Registration</h2>
		<div id="register_delegate">
			<center>
			<table style='font-family:verdana;font-size:12px;width:600px;background:#FFFFFF;border:0px solid #000099;padding:4px;'>
			<tr>
				<td width='40%' align='left'><b>Salutation : </b></td>
				<td width='60%' align='left'><select name='salutation'><option value='Dr'>Dr</option><option value='Mr'>Mr</option><option value='Ms'>Ms</option></select></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Family Name : </b></td>
				<td width='60%' align='left'><input type='text' name='familyname' size='50' placeholder='E.g. Teo' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>First Name : </b></td>
				<td width='60%' align='left'><input type='text' name='fullname' size='50' placeholder='E.g. John' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Name on Badge : </b></td>
				<td width='60%' align='left'><input type='text' name='badgename' size='50' placeholder='E.g. John.T' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Institution/Organisation : </b></td>
				<td width='60%' align='left'><input type='text' name='organisation' size='50' placeholder='E.g. Acme Pte. Ltd' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Designation (Job Title) : </b></td>
				<td width='60%' align='left'><input type='text' name='designation' size='50' placeholder='E.g. Manager' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Email Address : </b></td>
				<td width='60%' align='left'><input type='text' name='email' size='50' placeholder='E.g. johnteo@email.com' required></td>
			</tr>
			<tr>
				<td width='40%' align='left'><b>Mobile Contact : </b></td>
				<td width='60%' align='left'><input type='text' name='contact' id='contact' size='50' placeholder='98761111'></td>
			</tr>
			
			<tr>
				<td width='40%' align='left'><b>What best describes you and your company? Please select. </b></td>
				<td width='60%' align='left'>
					<select name="industry" id="industry">
					<?
						$SQL = "SELECT * FROM tbl_industry ORDER BY industry_order ASC, industry_name ASC";
						$results=$qry->queryMultiSelect($SQL);
						foreach($results as $result){
							echo "<option value='".$result['industry_id']."'>".$result['industry_name']."</option>";
						}
					?>
					</select></br>
					If others, please specify: 
					<input type='text' name='otherindustry' id='otherindustry' size='26'>
					</br>
				</td>
			</tr></br>
			<tr>
				<td width='40%' align='left' valign='top'>
					<b>I would like follow up from:</b>
				</td>
				<td width='60%' align='left'>
					<input type="checkbox" name="followup1" value="Yes">A*STAR<br/>
					<input type="checkbox" name="followup2" value="Yes">SPRING Singapore<br/>
					<input type="checkbox" name="followup3" value="Yes">IE Singapore<br/>
					<input type="checkbox" name="followup4" value="Yes">WDA<br/>
					<input type="checkbox" name="followup5" value="Yes">ASME<br/>
				</td>
			</tr>
			<tr>
				<td width='40%' align='left'>
					<b>Any specific query:</b>
				</td>
				<td width='60%' align='left'>
					<textarea name = 'query' rows = '5' cols = '50'></textarea>
				</td>
			</tr>
			<tr>
				<td><b>Source</b>: </td><td><select name='source_id'>
				<?
				$SQL = "SELECT * fROM tbl_source ORDER BY source_id ASC;";
				$sourceresults=$qry->queryMultiSelect($SQL);
				foreach ($sourceresults as $sourceresult){
					if ($result['source_id']==$sourceresult['source_id'])
						echo "<option value='".$sourceresult['source_id']."' selected>".$sourceresult['source_name']."</option>";
					else
						echo "<option value='".$sourceresult['source_id']."'>".$sourceresult['source_name']."</option>";
				}
				echo "</select></td></tr>";
				?>
			</table></br></br>
			<input type='submit' name='confirm' value='Confirm Walk-In' >
			</center>
		</div>
		</div> <!-- end #tabledata -->
		<?include("footer.php");?>
</div><!-- end container -->
<input type="hidden" name="offset" value="0">
</form>
</body>
</html>
