<?php
include("connect.php");
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$gender = $_POST['gender'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$address = $_POST['address'];
$postcode = $_POST['postcode'];
$state = $_POST['state'];
$country = $_POST['country'];
$email = $_POST['email'];
$phoneNo = $_POST['phoneNo'];
$userID = $_POST['userID'];
$password = $_POST['password'];

if(strlen($day)==1){
	$day = "0".$day;
}
if(strlen($month)==1){
	$month = "0".$month;
}

$birth = $day."-".$month."-".$year;

mysql_query("insert into customer (userID,password,fname,lname,gender,birthday,street,postcode,state,country,email,phone)
	values('$userID','$password','$fname','$lname','$gender','$birth','$address','$postcode','$state','$country','$email','$phoneNo')");

$query=mysql_query("select * from customer where userID='$userID'");
$display=mysql_fetch_array($query);
$no = $display['no'];
	
mysql_query("insert into shipping (user,fname,lname,street,postcode,state,country)
	values('$no','$fname','$lname','$address','$postcode','$state','$country')");
	
echo "<script language=javascript>alert('Sign Up successful!!');
		window.location='index.php'</script>";
?>