-
Notifications
You must be signed in to change notification settings - Fork 0
/
editpost.php
executable file
·35 lines (29 loc) · 1.16 KB
/
editpost.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once 'db/conn.php';
if (isset($_POST['submit'])){
//extract values the $_GET array
$id = $_POST['id'];
$fname = $_POST['firstname'];
$lname = $_POST['lastname'];
$dob = $_POST['dob'];
$email = $_POST['email'];
$contact = $_POST['phone'];
$specialty = $_POST['specialty'];
if(empty($_FILES["avatar"]["name"])){
$result = $crud->editAttendee($id, $fname, $lname, $dob, $email, $contact, $specialty, null);
}else{
$target_dir = 'uploads/';
$orig_file = $_FILES["avatar"]["tmp_name"];
$ext = pathinfo($_FILES["avatar"]["name"], PATHINFO_EXTENSION);
//$destination = $target_dir . basename($_FILES["avatar"]["name"]);
$destination = "$target_dir$contact.$ext";
move_uploaded_file($orig_file, $destination);
$result = $crud->editAttendee($id, $fname, $lname, $dob, $email, $contact, $specialty, $destination);
}
//Redirect to index.php
if($result){
header("Location: viewrecords.php");
}
}
include 'includes/errormessage.php';
?>