-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheditdriver.php
More file actions
29 lines (28 loc) · 875 Bytes
/
editdriver.php
File metadata and controls
29 lines (28 loc) · 875 Bytes
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
<?php require_once "dbconnect.php"; ?>
<?php
if(isset($_POST['type'])){
$type = $_POST['type'];
if($type == "deletedriver"){
$id = $_POST['id'];
$result = $connect->query("DELETE FROM driver WHERE id='$id'");
if($result){
echo "Successful";
}else{
echo "Error: " . $result->errors;
}
}elseif($type == "editdriver"){
$id = $_POST['id'];
$name = $_POST['name'];
$nid = $_POST['nid'];
$phone = $_POST['phone'];
$truck = $_POST['truck'];
$address = $_POST['address'];
$sql = $connect->query("UPDATE driver SET fullname='$name', nid='$nid', phone='$phone', address='$address', truck='$truck' WHERE id='$id'");
if($sql){
echo "Edit was successful";
}else{
echo "Error: ". $sql->errors;
}
}
}
?>