Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Personal Information Registration
- */
- // Place all required files here
- require_once('core/registerNew.php');
- if($_POST){
- // Declare the variables to prevent undefined var errors
- $lastname =""; $firstname = "";
- $middlename= ""; $address = "";
- $contact = ""; $gender = "";
- $course = ""; $bday = "";
- $bplace = ""; $telnum = "";
- $mother = ""; $father = "";
- $guardian = ""; $lastschool = "";
- if(!empty($_POST['lastname'])) $lastname = strip_tags($_POST['lastname']);
- if(!empty($_POST['firstname'])) $firstname = strip_tags($_POST['firstname']);
- if(!empty($_POST['middlename'])) $middlename = strip_tags($_POST['middlename']);
- if(!empty($_POST['address'])) $address = strip_tags($_POST['address']);
- if(!empty($_POST['contact'])) $contact = strip_tags($_POST['contact']);
- if(!empty($_POST['gender'])) $gender = strip_tags($_POST['gender']);
- if(!empty($_POST['course'])) $course = strip_tags($_POST['course']);
- if(!empty($_POST['bday'])) $bday = strip_tags($_POST['bday']);
- if(!empty($_POST['bplace'])) $bplace = strip_tags($_POST['bplace']);
- if(!empty($_POST['telnum'])) $telnum = strip_tags($_POST['telnum']);
- if(!empty($_POST['mother'])) $mother = strip_tags($_POST['mother']);
- if(!empty($_POST['father'])) $father = strip_tags($_POST['father']);
- if(!empty($_POST['guardian'])) $guardian = strip_tags($_POST['guardian']);
- if(!empty($_POST['lastschool'])) $lastschool = strip_tags($_POST['lastschool']);
- global $connect;
- $stmt = $connect->prepare("INSERT INTO `students`(`lastname`, `firstname`, `middlename`, `address`, `gender`, `course`, `bplace`, `mother`, `father`, `guardian`, `lastschool`, `contact`, `bday`, `telnum`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- $stmt->bind_param("ssssssssssssss",$lastname,$firstname,$middlename,$address,$gender,$course,$bplace,$mother,$father,$guardian,$lastschool,$contact,$bday,$telnum);
- if($stmt->execute()){
- echo "<script type='text/javascript'>alert('saved successfully...')</script>";
- } else {
- echo "<script type='text/javascript'> alert('Query: {$sql} failed with " . mysqli_error($connect) . "')</script>";
- }
- // Not necessary to close connection because connection ends after each request anyway.
- }
- ?>
Add Comment
Please, Sign In to add comment