-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate back.php
78 lines (32 loc) · 1.26 KB
/
create back.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
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>StudyBuddy Create </title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div id="wrapper">
<h1><a href="index.html">StudyBuddy</a><span>|create</span></h1>
<?php
$con = mysql_connect("localhost", REDACTED,REDACTED);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(REDACTED, $con);
if ($_POST['dept'] == NULL or $_POST['course'] == NULL or $_POST['day'] == NULL or $_POST['time'] == NULL or $_POST['name'] == NULL or $_POST['email'] == NULL) {
echo "<h2> Please fill out all fields of <a href='create.html'>the form </a>!</h2>";
}
else {
$sql="INSERT INTO Groups (Dept, Course, Day, Time, AMPM, Names, Emails) VALUES ('$_POST[dept]','$_POST[course]','$_POST[day]', '$_POST[time]', '$_POST[ampm]', '$_POST[name]', '$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<h2> Congratulations, your study group has been created! <a href=\"index.html\"> Back home. </a> </h2>"; }
mysql_close($con);
?>
</div>
</body>
</html>