Commit 3574da49 authored by rama chandra's avatar rama chandra
Browse files

updated some changes

parent bce65729
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script>
</head>
<body>
<div id="wrap">
<div class="container">
<div class="row">
<form class="form-horizontal" action="bulkupload.php" method="post" name="upload_excel" enctype="multipart/form-data">
<fieldset>
<!-- Form Name -->
<legend>Bulk Upload of Blood Data</legend>
<!-- File Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="filebutton">Select File</label>
<div class="col-md-4">
<input type="file" name="file" id="file" class="input-large">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton">Import data</label>
<div class="col-md-4">
<button type="submit" id="submit" name="Import" class="btn btn-primary button-loading" data-loading-text="Loading...">Import</button>
</div>
</div>
</fieldset>
</form>
</div>
<?php
get_all_records();
?>
</div>
</div>
<div>
<form class="form-horizontal" action="bulkupload.php" method="post" name="upload_excel"
enctype="multipart/form-data">
<div class="form-group">
<div class="col-md-4 col-md-offset-4">
<input type="submit" name="Export" class="btn btn-success" value="export to excel"/>
</div>
</div>
</form>
</div>
</body>
</html>
<?php
require('db.php');
include("auth.php");
if(isset($_POST["Import"])){
$filename=$_FILES["file"]["tmp_name"];
if($_FILES["file"]["size"] > 0)
{
$file = fopen($filename, "r");
while (($getData = fgetcsv($file, 10000, ",")) !== FALSE)
{
$sql = "INSERT into bloo (`id`, `uname`, `blood`, `age`, `mobile`, `city`, `dd`)
values ('$getData[0]','$getData[1]','$getData[2]','$getData[3]','$getData[4]','$getData[5]','$getData[6]')";
$result = mysqli_query($con, $sql);
if(!isset($result))
{
echo "<script type=\"text/javascript\">
alert(\"Invalid File:Please Upload CSV File.\");
window.location = \"dashboard.php\"
</script>";
}
else {
echo "<script type=\"text/javascript\">
alert(\"CSV File has been successfully Imported.\");
window.location = \"dashboard.php\"
</script>";
}
}
fclose($file);
}
}
if(isset($_POST["Export"])){
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
$output = fopen("php://output", "w");
fputcsv($output, array('ID', 'Donor Name', 'Blood Group', 'Age', 'Mobile', 'City', 'Last Donated Months'));
$query = "SELECT * from bloo ORDER BY id DESC";
$result = mysqli_query($con, $query);
while($row = mysqli_fetch_assoc($result))
{
fputcsv($output, $row);
}
fclose($output); }
?>
\ No newline at end of file
......@@ -15,6 +15,10 @@ include("auth.php"); //include auth.php file on all secure pages ?>
<p><a href="index.php">Home</a><p>
<p><a href="insert.php">Insert New Record</a></p>
<p><a href="view.php">View Records</a><p>
<p><a href="view1.php">View Records of Requested person and Donated person deatils</a><p>
<p><a href="insertintodonor.php">Donor and Blood Requiested Person Details</a></p>
<p><a href="bulkupload.html">To Bulk Upload the Data</a></p>
<form method="POST" action="filter_search.php" class="bg-white rounded pb_form_v1" >
<div class="form-group">
......
<?php
require('db.php');
include("auth.php");
$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$Rname = $_REQUEST['Rname'];
$blood1=$_REQUEST['blood1'];
$Dname = $_REQUEST['Dname'];
$ddate= $_REQUEST['ddate'];
$Hname = $_REQUEST['Hname'];
$ins_query = "INSERT INTO donations (Rname,blood1,Dname,ddate,Hname) VALUES ('$Rname', '$blood1', '$Dname','$ddate','$Hname')";
mysqli_query($con,$ins_query) or die(mysql_error());
$status = "New Record Inserted Successfully.</br></br><a href='view.php'>View Inserted Record</a>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert New Record</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="dashboard.php">Dashboard</a> | <a href="view.php">View Records</a> | <a href="logout.php">Logout</a></p>
<div>
<h1>Insert New Record</h1>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<p><input type="text" name="Rname" placeholder="Requested person Name" required /></p>
<p><input type="text" name="blood1" placeholder="Enter BLood Group" required /></p>
<p><input type="text" name="Dname" placeholder="eneter donor name" required /></p>
<p><input type="date" name="ddate" placeholder="donated date" required /></p>
<p><input type="text" name="mobile" placeholder="Enter Mobile No" required /></p>
<p><input type="text" name="Hname" placeholder="Enter Hospital Name" required /></p>
<p><input name="submit" type="submit" value="insert" /></p>
</form>
<p style="color:#FF0000;"><?php echo $status; ?></p>
</div>
</div>
</body>
</html>
<?php
require('db.php');
include("auth.php");
$query = "SELECT * from donations ";
$result = mysqli_query($con, $query) or die ( mysqli_error());
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Update Record</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="index.php">Home</a> | <a href="insert.php">Insert New Record</a> | <a href="logout.php">Logout</a></p>
<h2>View Records</h2>
<table width="100%" border="1" style="border-collapse:collapse;">
<thead>
<tr><th><strong>Requested Person Name</strong></th><th><strong>Requested Blood Group</strong></th><th><strong>Donor Name</strong></th><th><strong>Donated date</strong></th><th><strong>Hospital Name</strong></th></tr>
</thead>
<tbody>
<?php
$count=1;
$sel_query="Select * from donations ORDER BY ddate desc;";
$result = mysqli_query($con,$sel_query);
while($row = mysqli_fetch_assoc($result)) { ?>
<tr><td align="center"><?php echo $row["Rname"]; ?></td><td align="center"><?php echo $row["blood1"]; ?></td><td align="center"><?php echo $row["Dname"]; ?></td><td align="center"><?php echo $row["ddate"]; ?></td><td align="center"><?php echo $row["Hname"]; ?></td></tr>
<?php $count++; } ?>
</tbody>
</table>
</div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment