<? 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 = $_POST['Name'];
$mob = $_POST['mobile'];
$alternate = $_POST['dayphone'];
$bloodgroup = $_POST['bloodgroup'];
$state = $_POST['state'];
$city = $_POST['city'];
$subject = "Updated Donor Registration At Biharbloodbank.in";
$email = $_POST['email'];
$message = $_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)
{
?>
<html>
<body>


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


</body>
</html>
<?php
exit();
}
?>


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


$user="$_POST[username]";
$ipassword="$_POST[ipassword]";
$weight=="$_POST[weight]";
$how_often="$_POST[how_often]";
$age_more_than_18="$_POST[age_more_than_18]";


$sql="UPDATE users SET fname='$name',username='$user', ipassword='$ipassword',weight='$weight', email='$email', mobile='$mob', dayphone='$alternate', state='$state', city='$city', how_often='$how_often', suffered1='$age_more_than_18', status='1' WHERE username = '$user'";





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

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