-
Notifications
You must be signed in to change notification settings - Fork 0
/
test2.php
92 lines (60 loc) · 1.73 KB
/
test2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<html>
<head>
<title>php2</title>
<body>
<?php
$F_name = $_POST['F_name'];
$L_name = $_POST['L_name'];
$SID = $_POST['SID'];
$eMID = $_POST['eMID'];
$Current_statistics=$_POST['Current_statistics'];
$Modification=$_POST['Modification'];
$Feedback=$_POST['Feedback'];
$Investment=$_POST['Investment'];
/* --------------------------------------------------QUERY----------------------------- */
if ( !empty($F_name) && !empty($L_name) && !empty($SID) && !empty($eMID) && !empty($Current_statistics) && !empty($Modification) && !empty($Feedback) )
{
$servername = "localhost";
$username = "root";
$dbname ="sugan_SF";
// Create connection
$conn = new mysqli($servername, $username,"",$dbname);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
else
{
if ($Investment != 0)
{
$INSERT = "INSERT INTO MAINTENANCE(F_name,L_name,SID,eMID,Current_statistics,Modification,Feedback,Investment)
VALUES('$F_name','$L_name','$SID','$eMID','$Current_statistics','$Modification','$Feedback','$Investment' ) ";
}
else
{
$INSERT = "INSERT INTO MAINTENANCE(F_name,L_name,SID,eMID,Current_statistics,Modification,Feedback)
VALUES('$F_name','$L_name','$SID','$eMID','$Current_statistics','$Modification','$Feedback' ) ";
}
if(!mysqli_query($conn,$INSERT))
{
echo("Error description: " . mysqli_error($conn));
}
echo("<script type=\"text/javascript\">
window.alert('Feedback has been sent successfully');
window.location.href='SCIENTIST.html';
</script>");
$conn->close();
}
}
else
{
echo("<script type=\"text/javascript\">
window.alert('All fields are required!');
window.location.href='SCIENTIST.html';
</script>");
die();
}
?>
</body>
</html>