<?php
 $login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
$Name      = $_POST["Name"];
$Gender	   = $_POST["sex"];
$Age	   = $_POST["Age"];
$Address   = $_POST["Address"];
$Postcode  = $_POST["Postcode"];
$IC        = $_POST["IC"];
$Email     = $_POST["Email"];
$Phone     = $_POST["Phone"];
$HPhone    = $_POST["HPhone"];
$Position  = $_POST["Position"];

		if(($Name == "")||($Age == "")||($Address == "")
		||($Postcode == "")||($IC == "")||($Email == "")||($Phone == "")||($HPhone == "")||($Position == "")){

				echo "<script>alert('Please fill in your details completely! ')</script>";
				echo "<script language='javascript'>window.location='job.php'</script>";
				}else{
					$query = "INSERT INTO job(Name, Gender, Age, Address, Postcode, IC, Email, Phone, HPhone, Position)VALUES('$Name', '$Gender',
					'$Age', '$Address', '$Postcode', '$IC', '$Email', '$Phone', '$HPhone', '$Position')";
					$result = $db->query($query);
					
					$db->close();
					echo "<script language='javascript'>alert('Apply Successful.')</script>";
					echo "<script language='javascript'>window.location='index.php'</script>";
					}
?>