<? require_once "application_top.php"; ?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bihar Blood Bank</title>

<? include ("include/header.php"); ?>

	<table id="containerTable" border="0">
	<tr>
		<td width="220">
		<? require "left.php";?>
		</td>
		
		<td width="500px;text-align:center;">
		
		<h1>Registration Status</h1>
		
		<?=$msg;?>
		
<?php
/* Set e-mail recipient */

$myemail = "contact@biharbloodbank.in";



$name = mysql_real_escape_string($_POST['Name']);
$mob = $_POST['mobile'];
$alternate = $_POST['dayphone'];
$bloodgroup = $_POST['bloodgroup'];
$state = $_POST['state'];
$city = $_POST['city'];
$subject = "Donor Registration At Biharbloodbank.in";
$email = mysql_real_escape_string($_POST['email']);
$message = mysql_real_escape_string($_POST['message']);

/* Let's prepare the message for the e-mail */
$message = "

Name: $name
E-mail: $email
Mobile: $mob
Alternate: $alternate
Bloodgroup: $bloodgroup
State: $state
City: $city
Subject: $subject


$message

";

/* Send the message using mail() function */

mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */
echo('<div class=msg>Mail Sent successfully</div>');


/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}

function show_error($myError)
{
?>

<strong><div class=msg><?php echo $myError; ?></div></strong>



<?php
exit();
}
?>


<?php
//mysqli_connect(host,username,password,dbname);
$con=mysqli_connect("localhost","sauranbe_donator","25011992","sauranbe_biharbloodbank");
// Check connection
if (mysqli_connect_errno())
  {
  echo "<div class=msg>Registration Error</div>  " . mysqli_connect_error();
  }


$sql="INSERT INTO users (fname, username, ipassword, gender, weight, email, ydob, bloodgroup, mobile, dayphone, state, city, how_often, suffered1, status)
VALUES
('".mysql_real_escape_string($_POST['Name'])."','".mysql_real_escape_string($_POST['username'])."','$_POST[Password]', '$_POST[Gender]', '$_POST[weight]', '".mysql_real_escape_string($_POST['email'])."', '$_POST[ydob]', '$_POST[bloodgroup]', '$_POST[mobile]', '$_POST[dayphone]', '$_POST[state]', '$_POST[city]', '$_POST[how_often]', '$_POST[age_more_than_18]', '1')";





if (!mysqli_query($con,$sql))
  {
  die('Error: ' . mysqli_error($con));
  }
echo "<div class=msg>Registration successful</div> ";
echo"<br/>"; 

?>
		
		<br>
	</div>
</div>
		
		</td>
		
		<td width="220" align="right">
		<? require "right.php";?>
		</td>
	</tr>
	</table>
	
<? include ("include/footer.php"); ?>