-
Notifications
You must be signed in to change notification settings - Fork 2
/
insert.php
39 lines (25 loc) · 1.05 KB
/
insert.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
36
37
38
39
<?php
include('dbconfig.php');
if (isset($_POST['insert'])) {
//variable and value parsing
$ins_no=$_POST['insurancenumber'];
$contact_no=$_POST['contactnumber'];
$locat=$_POST['location'];
$descrip=$_POST['description'];
$photo=$_FILES['photo']['name'];
$defaultstat=1;
//insert data
$sql = "INSERT INTO claimdata VALUES ('$ins_no','$contact_no','$locat','$descrip','$photo',$defaultstat)";
//only the image name have been saved in database
if(mysqli_query($conn, $sql)){
move_uploaded_file($_FILES['photo']['tmp_name'],'uploads/'.$photo);//store claim images in uploads folder
header("Location: " . "claim.php");
} else{
echo "ERROR:Try again $sql. "
. mysqli_error($conn);
header("Location: " . "claim.php");
}
// Close connection
mysqli_close($conn);
}
?>