Donor registration ; <html> <head> <title>donor</title> <link rel="stylesheet" type="text/css" href="pro.css"> </head> <body> <a href="dlogin.php">Back</a> <center> <h2>Donor Registration</h2> <br><br><br> <form method ="post" name="frm" onsubmit="return Reg()"> <table > <tr><th align="left">Donor_id<font color=red>*</font>:</th><td><input type="text" name="d_id"/></td></tr> <tr><th align="left">Name <font color=red>*</font>:</th><td><input type="text" name="d_name" placeholder="Enter donor name"required/></td></tr> <tr><th align="left">BloodGroup <font color=red>*</font>:</th><td><select name="bdgp"> <option value="" selected>-- SELECT --</option> <option value="A+ve">A+ve</option> <option value="B+ve">B+ve</option> <option value="O+ve">O+ve</option> <option value="AB+ve">AB+ve</option> <option value="A-ve">A-ve</option> <option value="B-ve">B-ve</option> <option value="O-ve">O-ve</option> <option value="AB-ve">AB-ve</option> </select> </td></tr> <tr><th align="left">Password <font color=red>*</font>: </th><td align="left"><input type="password" name="d_pwd" placeholder="Enter your password "required /><font color=grey><font color=red>*</font>which is used for login</font></td></tr> <tr><th align="left">Gender <font color=red>*</font>:</th><td><select name="d_gender"> <option value="M" selected>Male</option> <option value="F">Female</option> <option value="O">Others</option> </select></td></tr> <tr><th align="left">Date Of Birth <font color=red>*</font>:</th><td><input type="date" name="d_dob" required/></td></tr> <tr><th align="left">Address <font color=red>*</font>:</th><td><textarea rows="5" cols="50" name="d_address" placeholder="Enter our address"required></textarea></td></tr> <tr><th align="left">Phone Number <font color=red>*</font>:</th><td><input type="number" name="d_phn" placeholder="Enter a valid phone number (10 digit)" required/></td></tr> <tr><th align="left">Donor_email<font color=red>*</font>:</th><td><input type="text" name="d_email" placeholder="Enter a vaid email id"required></td></tr> <tr><th align="left">City <font color=red>*</font>:</th><td><input type="text" name="d_city" placeholder="Enter your city"required/></td></tr> <tr><th align="left">Weight <font color=red>*</font>:</th><td><input type="number" name="d_weight" placeholder="Enter your weight " min="50"required/></td></tr> <tr><th align="left">Status <font color=red>*</font>:</th><td><select name="vol"> <option value="Volunteer" selected>Volunteer</option> <option value="NonVolunteer">NonVolunteer</option> </select></td></tr> <tr><th align="left">Last Donated Date:</th><td><input type="date" name="d_ldd" /></td></tr> <tr><th></th><td><br><br><input type="submit" name="next" value="SUBMIT"></td></tr> </table> </form> </body> </html> <?php include('connection.php'); if(isset($_POST['next'])) { $did=$_POST['d_id']; $dpwd=$_POST['d_pwd']; $dn=$_POST['d_name']; $da=$_POST['d_address']; $ddob=$_POST['d_dob']; $dg=$_POST['d_gender']; $dph=$_POST['d_phn']; $dem=$_POST['d_email']; $dc=$_POST['d_city']; $db=$_POST['bdgp']; $dw=$_POST['d_weight']; $ds=$_POST['vol']; $dldd=$_POST['d_ldd']; $rl="donor"; $qr="INSERT INTO donor (d_id,d_name,d_bgroup,d_gender,d_dob,d_address,d_phn,d_email,d_city,d_weight,d_status,d_ldd) VALUES ('$did','$dn','$db','$dg','$ddob','$da','$dph','$dem','$dc','$dw','$ds','$dldd')"; $result1=mysqli_query($conn,$qr) or die ("Not Inserted #1 : ".mysqli_error($conn)); if($result1) { $qry=mysqli_query($conn,"INSERT INTO login (uid,pwd,role) VALUES('$did','$dpwd','$rl')") or die("Not Inserted #2 : ".mysqli_error()); $result2=mysqli_query($conn,$qry) or die ("Not Inserted #1 : ".mysqli_error($conn)); if($result2) { echo"Registration Successful<br>"; header("refresh:3;url=dlogin.php"); } } else { echo"Registration Unsuccessful:<hr>".mysqli_error($conn); header("refresh:5;url=1donor.php"); } } ?> <script> function Reg() { var di=document.forms["frm"]["d_id"]; var n=document.forms["frm"]["d_name"]; var db=document.forms["frm"]["dropdown"]; var p=document.forms["frm"]["d_pwd"]; var dg=document.forms["frm"]["d_gender"]; var d=document.forms["frm"]["d_dob"]; var a=document.forms["frm"]["d_address"]; var m=document.forms["frm"]["d_phn"]; var e=document.forms["frm"]["d_email"]; var c=document.forms["frm"]["d_city"]; var w=document.forms["frm"]["d_weight"]; var s=document.forms["frm"]["dropdown"]; var ldd=document.forms["frm"]["d_ldd"]; if(di.value==" ") { alert("Please enter Donor Id"); di.focus(); return false; } if(n.value==" ") { alert("Please enter name"); n.focus(); return false; } var l=/^[A-Za-z]+$/; if(!n.value.match(l)) { alert("Please enter a valid name"); n.focus(); return false; } if(db.value==" ") { alert("Please enter donor's blood group"); db.focus(); return false; } if(p.value==" ") { alert("Please enter password"); p.focus(); return false; } if(p.value.length < 0||p.value.length < 5 ) { alert("Enter a password with atleast 5 characters"); p.focus(); return false; } if(dg.value==" ") { alert("Please enter donor's gender"); dg.focus(); return false; } if(d.value==" ") { alert("Please enter date of birth"); d.focus(); return false; } if(a.value==" ") { window.alert("Please enter address"); a.focus(); return false; } /*var al=/^[A-Za-z ]+$/; if(!a.value.match(al)) { alert("Please enter a valid address"); a.focus(); return false; } */ if(m.value==" ") { alert("Please enter phone number"); m.focus(); return false; } if(m.value.length !=10) { alert("The mob_no must be 10 digits"); m.focus(); return false; } var mn=/^[0-9]+$/; if(!m.value.match(mn)) { alert("Please enter a valid mobile number"); m.focus(); return false; } if(e.value==" ") { alert("Please enter an email_id"); e.focus(); return false; } if(e.value.indexOf("@",0)<0) { alert("Please enter a valid email_id"); e.focus(); return false; } if(e.value.indexOf(".com",0)<0) { alert("Please enter a valid email_id"); e.focus(); return false; } if(c.value==" ") { alert("Please enter city"); c.focus(); return false; } if(w.value==" ") { alert("Please enter weight"); w.focus(); return false; } if(s.value==" ") { alert("Please enter status"); s.focus(); return false; } return true; } </script> Login ; <html> <head> <title> Login </title> <link rel="stylesheet" type="text/css" href="logincss.css"> </head> <body> <center><br><br><br><br><br><br><br><br><br> <h1><big>A D M I N&nbsp;&nbsp;&nbsp;&nbsp;L O G I N&nbsp;&nbsp;</big></h1> <br><br><br><br><br> <form method ="POST" name="frm" onsubmit="return Avalidate()"> <table align="center"> <img src="bloodpic.png" align="left" /> <tr><th align="center"><h4>USER_ID: </h4></th><td align="right"><input type="text" name="uid" required /></td></tr> <tr><th align="center"><h4>PASSWORD : </h4></th><td align="right"><input type="password" name="pwd" required /></td></tr> <tr><td></td><td align="center"><input type="submit" name="submit" value="LOGIN" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="CLEAR" /></td></tr> <tr><td colspan="2" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;<a href="Home.php">BACK TO HOME PAGE</a> </table> </form> </center> <br><br><br><br> </body> </html> <?php session_start(); if(isset($_POST["submit"])) { $uid=$_POST["uid"]; $pwd=$_POST["pwd"]; $conn = mysqli_connect ("localhost","root",""); if(!$conn) {die("could not connect:".mysqli_error());} //else //echo"successful connection<br>"; $db_fnd=mysqli_select_db($conn,"project"); if(!$db_fnd) {die("could not connect:".mysqli_error() );} //else //echo"successful connection<br>"; $qr=mysqli_query($conn,"select * from login where uid='$uid' and pwd='$pwd' and role='admin' ") or die("Error:".mysqli_error($conn)); //and Role='Admin' if(mysqli_num_rows($qr)>0) { $_SESSION['uid']=$uid; header("location:admin.html"); exit; } else { echo"Invalid username or password<br>"; header("refresh:3;url=alogin.php"); } mysqli_close($conn); } ?> <script> function Avalidate() { var u=document.forms["frm"]["uid"]; var p=document.forms["frm"]["pwd"]; if(u.value==" ") { window.alert("Please enter UserId"); u.focus(); return false; } if(p.value==" ") { alert("Please enter password"); p.focus(); return false; } if(p.value.length < 0||p.value.length < 5 ) { alert("Enter a password with atleast 5 characters"); n.focus(); return false; } return true; } </script> Patient registration ; <html> <head> <title>patient</title> <link rel="stylesheet" type="text/css" href="pro1.css"> </head> <body><center> <h2>Patient</h2> <br><br><br> <form method ="post" name="pform" onsubmit="return Regis()"> <table> <tr><th>Patient_id <font color=red>*</font>:</th><td><input type="text" name="pid"/></td></tr> <tr><th>Name <font color=red>*</font>:</th><td><input type="text" name="pname" placeholder="Enter patient name"required/></td></tr> <tr><th>BloodGroup <font color=red>*</font>:</th><td><select name="dropdown"> <option value="A+ve" selected>A+ve</option> <option value="B+ve">B+ve</option> <option value="0+ve">O+ve</option> <option value="AB+ve">AB+ve</option> <option value="A-ve">A-ve</option> <option value="B-ve">B-ve</option> <option value="O-ve">O-ve</option> <option value="AB-ve">AB-ve</option> </td></tr> <tr><th align="left">Date Of Birth <font color=red>*</font>:</th><td><input type="date" name="pdob"required/></td></tr> <tr><th>Gender <font color=red>*</font>:</th><td><input type="radio" name="pgender"value="Male"/>Male <input type="radio" name="pgender"value="Female"/>Female <input type="radio" name="pgender"value="Others"/>Others</td></tr> <tr><th>Password <font color=red>*</font>:</th><td><input type="text" name="ppwd" placeholder="Enter your password"required/><font color=grey><font color=red>*</font>which is used for login with atleast 5 characters</font></td></tr> <tr><th>Address <font color=red>*</font>:</th><td><textarea rows="5" cols="50" name="paddress" placeholder="Enter patient address"required></textarea></td></tr> <tr><th>Phone No <font color=red>*</font>:</th><td><input type="number" name="pphno" placeholder="Enter valid phone number"required/><font color=grey><font color=red>*</font>must have 10 digit</font></td></tr> <tr><th>Email <font color=red>*</font>:</th><td><input type="text" name="pemail" placeholder="Enter valid email id"required/></td></tr> <tr><th></th><td><br><br><input type="submit" name="sub" value="SUBMIT"></td></tr> </table> </form> </center> </body> </html <?php if(isset($_POST['sub'])) { $conn = mysqli_connect ("localhost","root",""); if(!$conn) {die("could not connect:".mysqli_error());} else echo"successful connection<br>"; $db_fnd=mysqli_select_db($conn,"project"); if(!$db_fnd) {die("could not connect:".mysqli_error() );} else echo"successful connection<br>"; $pid=$_POST['pid']; $pname=$_POST['pname']; $pbg=$_POST['dropdown']; $pgender=$_POST['pgender']; $ppwd=$_POST['ppwd']; $paddress=$_POST['paddress']; $pphno=$_POST['pphno']; $pemail=$_POST['pemail']; $rl="patient"; $qr=mysqli_query($conn,"INSERT INTO patient VALUES ('$pid','$pname','$pbg','$pgender','$ppwd','$paddress','$pphno','$pemail')"); $qry=mysqli_query($conn,"INSERT INTO login VALUES('$pid','$ppwd','$rl')");//(d_id,d_pwd) if($qr) { if($qry) { echo"Registration Successful<br>"; header("refresh:3;url=plogin.php"); } } else { echo"Registration Unsuccessful:<hr>".mysqli_error($conn); header("refresh:5;url=patient.php"); } } ?> <script> function Regis() { var pi=document.forms["pform"]["pid"]; var pn=document.forms["pform"]["pname"]; var pbgrp=document.forms["pform"]["dropdown"]; var pg=document.forms["pform"]["pgender"]; var p_pwd=document.forms["pform"]["ppwd"]; var pad=document.forms["pform"]["paddress"]; var p_phno=document.forms["pform"]["pphno"]; var pem=document.forms["pform"]["pemail"]; if(pi.value==" ") { alert("Please enter Patient Id"); pi.focus(); return false; } if(pn.value==" ") { alert("Please enter name"); pname.focus(); return false; } var m=/^[A-Za-z]+$/; if(!pn.value.match(m)) { alert("Please enter a valid name"); pn.focus(); return false; } if(pbgrp.value==" ") { alert("Please enter patient's blood group"); pbgrp.focus(); return false; } if(pg.value==" ") { alert("Please enter gender"); pg.focus(); return false; } if(p_pwd.value==" ") { alert("Please enter password"); p_pwd.focus(); return false; } if(p_pwd.value.length < 0||p.value.length < 5 ) { alert("Enter a password with atleast 5 characters"); p_pwd.focus(); return false; } if(pad.value==" ") { window.alert("Please enter address"); pad.focus(); return false; } var as=/^[A-Za-z ]+$/; if(!pad.value.match(as)) { alert("Please enter a valid address"); pad.focus(); return false; } if(p_phno.value==" ") { alert("Please enter phone number"); p_phno.focus(); return false; } if(p_phno.value.length !=10) { alert("The mob_no must be 10 digits"); p_phno.focus(); return false; } var mn=/^[0-9]+$/; if(!p_phno.value.match(mn)) { alert("Please enter a valid mobile number"); p_phno.focus(); return false; } if(pem.value==" ") { alert("Please enter an email_id"); pem.focus(); return false; } if(pem.value.indexOf("@",0)<0) { alert("Please enter a valid email_id"); pem.focus(); return false; } if(pem.value.indexOf(".com",0)<0) { alert("Please enter a valid email_id"); pem.focus(); return false; } return true; } </script> Blood stock ; <?php require_once 'Connection.php'; ?> <html> <body><br> <h1 align="center">Blood Stock</h1> <br><center><br> <table align=center> <tr><th align="left">BLOOD GROUP : <form method="post"> <select name="dropdown"> <option value="" selected>-- SELECT --</option> <option value="A+ve">A+ve</option> <option value="B+ve">B+ve</option> <option value="O+ve">O+ve</option> <option value="AB+ve">AB+ve</option> <option value="A-ve">A-ve</option> <option value="B-ve">B-ve</option> <option value="O-ve">O-ve</option> <option value="AB-ve">AB-ve</option> </select> <input type="submit" name="search" value= "SEARCH BY BLOOD GROUP" /></th> <th><input type="submit" name="view" value= "VIEW ALL Blood Bags" /> </form> </th></tr> </table> <?php include("connection.php"); // VIEW if(isset($_POST['view'])) { $qr=" SELECT * FROM blood_stock,donor where blood_stock.did=donor.d_id"; $qry=mysqli_query($conn,"$qr") or die("Error:".mysqli_error($conn)); $n=mysqli_num_rows($qry); echo "[ <b><big> Total Blood Bags Available : ".$n."</big></b> ] </p>"; echo "<table border=1 width=80% height=20%> <tr> <th>SLNO</th> <th>BLOOD GROUP</th> <th>QUANTITY</th> </tr>"; $i=1; while($row=mysqli_fetch_array($qry)) { echo "<tr> <td>".$i++."</td> <td>".$row['d_bgroup']."</td> <td>".$row['quantity']."</td> </tr>"; } echo "</table>"; } // SEARCH if(isset($_POST['search'])) { $d_bgroup=$_POST['dropdown']; if($d_bgroup!="") { $qr=" SELECT * FROM blood_stock,donor where blood_stock.did=donor.d_id and d_bgroup like '".$d_bgroup."'"; $qry=mysqli_query($conn,"$qr") or die("Error:".mysqli_error($conn)); if (mysqli_num_rows($qry)<1) { echo "!!! No Blood Bag available for the Blood Group <b><big>".$d_bgroup."</big></b> !!!</p>"; } else { $n=mysqli_num_rows($qry); echo "Blood Bag available for the Blood Group <b><big>".$d_bgroup."</big></b> [ <b><big> Total : ".$n."</big></b> ] </p>"; echo "<table align=center valign=middle border=1 width=50% cellpadding=5 cellspacing=3> <tr> <th>SLNO</th> <th>BLOOD GROUP</th> <th>DONATED DATE</th> <th>EXPIRY DATE</th> </tr>"; $i=1; while($row=mysqli_fetch_array($qry)) { echo "<tr> <td>".$i++."</td> <td>".$row['d_bgroup']."</td> <td>".$row['donated_date']."</td> <td>".$row['expiry_date']."</td> <td align=center> <form action=dltdonor.php method=POST> <input type=hidden name=d_id value=".$row['d_id']."> <input type=submit name=dl value=Delete> </form> <form action=updtdonor.php method=POST> <input type=hidden name=d_id value=".$row['d_id']."> <input type=submit name=up value=Update> </form> </td> </tr>"; } echo "</table>"; } } else { echo "<br><br><p id=err>Please specify the Blood Group for Checking !!!</p>"; } } ?> </body></html> Booking ; <?php include('connection.php'); if(isset($booked)) { $sql="insert into booking(bid,pid,needed_date,quantity,doctor_name,purpose,booking_date) values('$bid','$pid','$needed_date','$quantity','$doctor_name','$purpose','$booking_date')"; if(mysqli_query($con,$sql)) { $msg= "<h1 style='color:blue'>You have Successfully booked </h1><h2><a href='vorder.php'> <u>View </u></a></h2>"; } } ?> <html> <head> <title>Online Booking</title> <link rel="stylesheet" type="text/css" href="pro1.css"> </head> <body align="center"> <?php ?> <h1><b><u> Booking</u></b> </h1><br> <?php if() echo @$msg; ?> <!--Form Containe Start Here--> <form method="post"> <table align="center"> <tr><th align="left">Booking ID :</th> <td align="left"> <input type="text" value="<?php echo $result['bid']; ?>" readonly="readonly" name="bid" required></td></tr> <tr><th align="left">Patient ID :</th> <td align="left"><input type="text" value="<?php echo $result['pid']; ?>" readonly="readonly" name="pid" required/></td></tr> <tr><th align="left">Needed Date :</th> <td align="left"><input type="date" name="needed_date" placeholder="Type Needed Date"required></td></tr> <tr><th align="left">Quantity :</th> <td align="left"><input type="number" name="quantity" placeholder="Enter Needed Number Of Bags" required></td></tr> <tr><th align="left"> Doctor Name :</th> <td align="left"><input type="text" name="doctor_name" placeholder="Enter Doctor Name"required></td></tr> <tr><th align="left">Purpose :</th> <td align="left"><textarea Rows="5" Cols="25" name="purpose"></textarea></td></tr> <tr><th></th><td align="left"><br><br><br><br><br><input type="submit"value="BOOK" name="booked" required/></td></tr> </table> </form><br> <table border=1 width=80% height="20%"> <tr> <th>SLNO</th> <th>BOOKING ID</th> <th>NEEDED DATE</th> <th>QUANTITY</th> <th>DOCTOR NAME</th> <th>PURPOSE</th> <th>BOOKING DATE</th> </tr> <?php session_start(); $pid=$_SESSION['pid']; $date=date("Y-m-d"); include("connection.php"); $qr=" SELECT * FROM booking where bid='$pid'"; $qry=mysqli_query($conn,"$qr") or die("Error:".mysqli_error($conn)); $i=1; while($row=mysqli_fetch_array($qry)) { echo "<tr> <td>".$i++."</td> <td>".$row['bid']."</td> <td>".$row['needed_date']."</td> <td>".$row['quantity']."</td> <td>".$row['doctor_name']."</td> <td>".$row['purpose']."</td> <td>".$row['booking_date']."</td> <td align=center><br> <form action=delete_booking.php method=POST> <input type=hidden name=bid value=".$row['bid']."> <input type=submit name=dl value=CANCEL> </form> <br> </td> </tr>"; } ?> </table> </body> </html> Billing ; <!DOCTYPE html> <html> <head> <title>Billing</title> <meta http-equiv="refresh" content="20"> <style type="text/css"> body { //background-color: lightgrey; text-align: center; margin: 0; font-family: Calibri; } .form input, select { font-family: "Times New Roman"; padding: 5px; color: teal; font-stretch: 10px; //background-color: lightgrey; border-width: 0px 0px 1px 0px; border-bottom-color: tomato; } input[type=submit],[type=reset] { font-family: "Times New Roman"; padding: 10px; width: 60px; height: 40px; color: teal; border-radius: 40px; cursor: pointer; } input[type=submit]:hover,[type=reset]:hover { font-family: "Times New Roman"; padding: 10px; width: 60px; height: 40px; background-color: teal; color: white; border-radius: 40px; box-shadow: 2px 2px grey; cursor: pointer; } </style> </head> <body> <form method="post" class="form"> <table align="center"> <tr><th>Name : </th> <td><input type="text" name="name" placeholder="Enter your Name"></td> </tr> <tr><th>Mobile : </th> <td><input type="number" name="mob" placeholder="Mobile Number"></td> </tr> <tr><th>Age : </th> <td><input type="number" name="age" placeholder="Age" min="18" max="50"></td> </tr> <!--<tr><th>Time : </th> <td><input type="time" name="time"></td> </tr>--> <tr><th>Bags (purchased) : </th> <td><select name="bp"> <option value="0" selected>Nill</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select><select name="bgrp"> <option value="" selected>-- SELECT --</option> <option value="A+ve">A+ve</option> <option value="B+ve">B+ve</option> <option value="O+ve">O+ve</option> <option value="AB+ve">AB+ve</option> <option value="A-ve">A-ve</option> <option value="B-ve">B-ve</option> <option value="O-ve">O-ve</option> <option value="AB-ve">AB-ve</option> </select></td> </tr> <tr><th>Bags (donated) : </th> <td><select name="bd"> <option value="0" selected>Nill</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select><input type="text" name="did" placeholder="By whom ?"></td> </tr> <tr><th colspan="2" align="center"><input type="checkbox" name="agree" checked> I agree that all the information entered are correct</th> </tr> <tr align="center"><th colspan="2"><input type="submit" name="submit" value="Proceed">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="Clear"></th> </tr> </table> </form> </body> </html> <?php include('connection.php'); if(isset($_POST['submit'])) { $nm=$_POST['name']; $mob=$_POST['mob']; $age=$_POST['age']; $did=$_POST['did']; $purchase=$_POST['bp']; $blood=$_POST['bgrp']; $donate=$_POST['bd']; echo "<HR>"; $date=date("d-M-Y"); $ddate=date("Y-m-d"); $edate=date("Y-m-d",strtotime("+35 days")); if($purchase!='0') { if($blood!=""){ if ($purchase>0 && $donate>0) { if ($purchase>$donate) $res=$purchase-$donate; else if ($purchase<=$donate) $res=0; } else { if ($purchase!='0') $res=$purchase; else if ($donate!='0') $res=0; } echo "Name : ".$nm; echo "<BR>Mobile : +91 ".$mob; echo "<BR>Age : ".$age; echo "<BR>Purchased (Rs 950/bag) : ".$purchase."bags of Blood Group ".$blood; echo "<BR>Donated : ".$donate; echo "<BR><HR><BR>"; echo "Date : ".$date; echo "<BR>Bill : Rs ".$res*950; echo "<BR><BR><HR><BR>"; //$qry1="update from blood_stock where "; } else echo "<BR>Please specify Blood Group!"; } else if($donate!='0') { if ($did) { echo "Name : ".$nm; echo "<BR>Mobile : +91 ".$mob; echo "<BR>Age : ".$age; echo "<BR>Donated : ".$donate; echo "<BR>Date : ".$date; echo "<BR><HR><BR>"; //$didres="select d_id from donor where d_name like '".$did."'"; //echo "select d_id from donor where d_name like '".$did."'"; //$didresult=mysqli_query($conn,"$didres") or die("Error:".mysqli_error($conn)); //while($row=mysqli_fetch_array($didresult)) //{ //echo "insert into blood_stock values ('',$donate,$ddate,$edate,".$row['d_id'].")"; //$qry2="insert into blood_stock values ('',$donate,$ddate,$edate,".$row['d_id'].")"; $didres="select * from blood_stock"; $didresult=mysqli_query($conn,"$didres") or die("Error:".mysqli_error($conn)); $n=mysqli_num_rows($didresult); //echo "insert into blood_stock(bagid,quantity,donated_date,expiry_date,did) values ('".$n++."',$donate,$ddate,$edate,$did)"; $qry2="insert into blood_stock(bagid,quantity,donated_date,expiry_date,did) values ('".$n++."',$donate,$ddate,$edate,$did)"; $result=mysqli_query($conn,"$qry2") or die("Error:".mysqli_error($conn)); if($result) echo "Successfully Inserted..."; //echo "Bill : Rs ".$res*950; //echo "<BR><BR><HR><BR>"; } else echo "<BR>Please specify Donor Name!"; } else echo "<BR>Fill in the details!"; } ?>