<?php
include("../commonpages/dbconnect.php");
if(isset($_POST['register'])){
$firstname=addslashes($_POST['firstname']);	
$lastname=addslashes($_POST['lastname']);	
$email=addslashes($_POST['email']);	
$password=addslashes($_POST['password']);	
$day=$_POST['day'];	
$month=$_POST['month'];	
$year=$_POST['year'];	
$optradio=$_POST['optradio'];	
$city=$_POST['city'];	
$country=$_POST['country'];	

echo $sql = "insert into user_registration(first_name,last_name,email,password,dob_date,dob_month,dob_year,gender,city,country) values('$firstname','$lastname','$email','$password','$day','$month','$year','$optradio','$city','$country')";
mysqli_query($con,$sql);

$select="SELECT id FROM user_registration WHERE email='$email'";
$data=mysqli_query($con,$select);
						if(mysqli_num_rows($data)>0)
						{
						$row=mysqli_fetch_array($data);
						$id=$row['id'];
						}
$sql_edu="INSERT INTO education(user_id) VALUES($id)";
mysqli_query($con,$sql_edu);
$sql_work="INSERT INTO work(user_id) VALUES($id)";
mysqli_query($con,$sql_work);

header("Location:../index.php");
}

?>