Server IP : 162.240.98.243 / Your IP : 3.15.226.71 Web Server : Apache System : Linux server.bti.yaw.mybluehostin.me 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : btiyawmy ( 1003) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/btiyawmy/public_html/login.easenup.in/ |
Upload File : |
<?php session_start(); include("header.php"); include("dbconnection.php"); if(isset($_POST[submit])) { if(isset($_GET[editid])) { $sql ="UPDATE patient SET patientname='$_POST[patientname]',admissiondate='$_POST[admissiondate]',admissiontime='$_POST[admissiontme]',address='$_POST[address]',mobileno='$_POST[mobilenumber]',city='$_POST[city]',pincode='$_POST[pincode]',loginid='$_POST[loginid]',password='$_POST[password]',bloodgroup='$_POST[select2]',gender='$_POST[select3]',dob='$_POST[dateofbirth]',status='$_POST[select]' WHERE patientid='$_GET[editid]'"; if($qsql = mysqli_query($con,$sql)) { echo "<script>alert('patient record updated successfully...');</script>"; } else { echo mysqli_error($con); } } else { $sql ="INSERT INTO patient(patientname,admissiondate,admissiontime,address,mobileno,city,pincode,loginid,password,bloodgroup,gender,dob,status) values('$_POST[patientname]','$dt','$tim','$_POST[address]','$_POST[mobilenumber]','$_POST[city]','$_POST[pincode]','$_POST[loginid]','$_POST[password]','$_POST[select2]','$_POST[select3]','$_POST[dateofbirth]','Active')"; if($qsql = mysqli_query($con,$sql)) { echo "<script>alert('patients record inserted successfully...');</script>"; $insid= mysqli_insert_id($con); if(isset($_SESSION[adminid])) { echo "<script>window.location='appointment.php?patid=$insid';</script>"; } else { echo "<script>window.location='patientlogin.php';</script>"; } } else { echo mysqli_error($con); } } } if(isset($_GET[editid])) { $sql="SELECT * FROM patient WHERE patientid='$_GET[editid]' "; $qsql = mysqli_query($con,$sql); $rsedit = mysqli_fetch_array($qsql); } ?> <div class="wrapper col2"> <div id="breadcrumb"> <ul> <li class="first">Add New Patient</li></ul> </div> </div> <div class="wrapper col4"> <div id="container"> <h1>Patient profile Registration Panel</h1> <form method="post" action="" name="frmpatient" onSubmit="return validateform()"> <table width="200" border="3"> <tbody> <tr> <td width="34%">Patient Name</td> <td width="66%"><input type="text" name="patientname" id="patientname" value="<?php echo $rsedit[patientname]; ?>"/></td> </tr> <?php if(isset($_GET[editid])) { ?> <tr> <td>Admission Date</td> <td><input type="date" name="admissiondate" id="admissiondate" value="<?php echo $rsedit[admissiondate]; ?>" readonly /></td> </tr> <tr> <td>Admission Time</td> <td><input type="time" name="admissiontme" id="admissiontme" value="<?php echo $rsedit[admissiontime]; ?>" readonly /></td> </tr> <?php } ?> <tr> <td>Address</td> <td><textarea name="address" id="address" cols="45" rows="5"><?php echo $rsedit[address]; ?></textarea></td> </tr> <tr> <td>Mobile Number</td> <td><input type="text" name="mobilenumber" id="mobilenumber" value="<?php echo $rsedit[mobileno]; ?>" /></td> </tr> <tr> <td>City</td> <td><input type="text" name="city" id="city" value="<?php echo $rsedit[city]; ?>" /></td> </tr> <tr> <td>PIN Code</td> <td><input type="text" name="pincode" id="pincode" value="<?php echo $rsedit[pincode]; ?>" /></td> </tr> <tr> <td>Login ID</td> <td><input type="text" name="loginid" id="loginid" value="<?php echo $rsedit[loginid]; ?>"/></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password" id="password" value="<?php echo $rsedit[password]; ?>" /></td> </tr> <tr> <td>Confirm Password</td> <td><input type="password" name="confirmpassword" id="confirmpassword" value="<?php echo $rsedit[confirmpassword]; ?>"/></td> </tr> <tr> <td>Blood Group</td> <td><select name="select2" id="select2"> <option value="">Select</option> <?php $arr = array("A+","A-","B+","B-","O+","O-","AB+","AB-"); foreach($arr as $val) { if($val == $rsedit[bloodgroup]) { echo "<option value='$val' selected>$val</option>"; } else { echo "<option value='$val'>$val</option>"; } } ?> </select></td> </tr> <tr> <td>Gender</td> <td><select name="select3" id="select3"> <option value="">Select</option> <?php $arr = array("MALE","FEMALE"); foreach($arr as $val) { if($val == $rsedit[gender]) { echo "<option value='$val' selected>$val</option>"; } else { echo "<option value='$val'>$val</option>"; } } ?> </select></td> </tr> <tr> <td>Date Of Birth</td> <td><input type="date" name="dateofbirth" max="<?php echo date("Y-m-d"); ?>" id="dateofbirth" value="<?php echo $rsedit[dob]; ?>"/></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Submit" /></td> </tr> </tbody> </table> </form> <p> </p> </div> </div> </div> <div class="clear"></div> </div> </div> <?php include("footer.php"); ?> <script type="application/javascript"> var alphaExp = /^[a-zA-Z]+$/; //Variable to validate only alphabets var alphaspaceExp = /^[a-zA-Z\s]+$/; //Variable to validate only alphabets and space var numericExpression = /^[0-9]+$/; //Variable to validate only numbers var alphanumericExp = /^[0-9a-zA-Z]+$/; //Variable to validate numbers and alphabets var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; //Variable to validate Email ID function validateform() { if(document.frmpatient.patientname.value == "") { alert("Patient name should not be empty.."); document.frmpatient.patientname.focus(); return false; } else if(!document.frmpatient.patientname.value.match(alphaspaceExp)) { alert("Patient name not valid.."); document.frmpatient.patientname.focus(); return false; } else if(document.frmpatient.admissiondate.value == "") { alert("Admission date should not be empty.."); document.frmpatient.admissiondate.focus(); return false; } else if(document.frmpatient.admissiontme.value == "") { alert("Admission time should not be empty.."); document.frmpatient.admissiontme.focus(); return false; } else if(document.frmpatient.address.value == "") { alert("Address should not be empty.."); document.frmpatient.address.focus(); return false; } else if(document.frmpatient.mobilenumber.value == "") { alert("Mobile number should not be empty.."); document.frmpatient.mobilenumber.focus(); return false; } else if(!document.frmpatient.mobilenumber.value.match(numericExpression)) { alert("Mobile number not valid.."); document.frmpatient.mobilenumber.focus(); return false; } else if(document.frmpatient.city.value == "") { alert("City should not be empty.."); document.frmpatient.city.focus(); return false; } else if(!document.frmpatient.city.value.match(alphaspaceExp)) { alert("City not valid.."); document.frmpatient.city.focus(); return false; } else if(document.frmpatient.pincode.value == "") { alert("Pincode should not be empty.."); document.frmpatient.pincode.focus(); return false; } else if(!document.frmpatient.pincode.value.match(numericExpression)) { alert("Pincode not valid.."); document.frmpatient.pincode.focus(); return false; } else if(document.frmpatient.loginid.value == "") { alert("Login ID should not be empty.."); document.frmpatient.loginid.focus(); return false; } else if(!document.frmpatient.loginid.value.match(alphanumericExp)) { alert("Login ID not valid.."); document.frmpatient.loginid.focus(); return false; } else if(document.frmpatient.password.value == "") { alert("Password should not be empty.."); document.frmpatient.password.focus(); return false; } else if(document.frmpatient.password.value.length < 8) { alert("Password length should be more than 8 characters..."); document.frmpatient.password.focus(); return false; } else if(document.frmpatient.password.value != document.frmpatient.confirmpassword.value ) { alert("Password and confirm password should be equal.."); document.frmpatient.confirmpassword.focus(); return false; } else if(document.frmpatient.select2.value == "") { alert("Blood Group should not be empty.."); document.frmpatient.select2.focus(); return false; } else if(document.frmpatient.select3.value == "") { alert("Gender should not be empty.."); document.frmpatient.select3.focus(); return false; } else if(document.frmpatient.dateofbirth.value == "") { alert("Date Of Birth should not be empty.."); document.frmpatient.dateofbirth.focus(); return false; } else if(document.frmpatient.select.value == "" ) { alert("Kindly select the status.."); document.frmpatient.select.focus(); return false; } else { return true; } } </script>