Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- date_default_timezone_set('Europe/London');
- $dtime = date('d/m/Y H:i');
- $user = 'root';
- $password = '';
- $db = new PDO('mysql:host=localhost;dbname=login', $user, $password );
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $form = $_POST;
- $fname = $form['fname'];
- $sname = $form['sname'];
- $dob = $form['dob'];
- $email = $form['email'];
- $role = $form['role'];
- $location = $form['location'];
- $why = $form['why'];
- $rpexp = $form['rpexp'];
- $pastrp = $form['pastrp'];
- $tandc = $form['tandc'];
- $status = '0';
- //make sure user has accepted terms and conditions
- if ($tandc == '1') {
- //make sure email is valid
- if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
- //prepare statements
- $stmt = $db->prepare("INSERT INTO applications (`fname`, `sname`, `dob`, `email`, `role`, `location`, `why`, `rpexp`, `pastrp`, `status`, `dofsubmission`)
- VALUES (:fname, :sname, :dob, :email, :role, :location, :why, :rpexp, :pastrp, :status, :dtime)");
- //insert blind paramaters
- $stmt->bindParam(':fname', $fname, $db::PARAM_STR);
- $stmt->bindParam(':sname', $sname, $db::PARAM_STR);
- $stmt->bindParam(':dob', $dob, $db::PARAM_STR);
- $stmt->bindParam(':email', $email, $db::PARAM_STR);
- $stmt->bindParam(':role', $role, $db::PARAM_STR);
- $stmt->bindParam(':location', $location, $db::PARAM_STR);
- $stmt->bindParam(':why', $why, $db::PARAM_STR);
- $stmt->bindParam(':rpexp', $rpexp, $db::PARAM_STR);
- $stmt->bindParam(':pastrp', $pastrp, $db::PARAM_STR);
- $stmt->bindParam(':status', $status, $db::PARAM_STR);
- $stmt->bindParam(':dtime', $dtime, $db::PARAM_STR);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement