-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatecategory.php
More file actions
129 lines (100 loc) · 2.36 KB
/
createcategory.php
File metadata and controls
129 lines (100 loc) · 2.36 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
session_start();
include 'header.php';
include 'connect.php';
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('button[type="submit"]').click(function(){
$("#coursedata").hide();
return false;
})
})
</script>
<style>
.noscroll {
width: 500px;
min-height: 130px;
font-family: Arial, sans-serif;
font-size: 13px;
color: #444;
padding: 5px;
}
.custom-file-upload {
border: 1px solid #ccc;
display: inline-block;
padding: 6px 12px;
cursor: pointer;
}
textarea {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 10px;
box-sizing: border-box;
}
input[type=text], select {
width: 100%;
padding: 12px 30px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 30px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: #47c9af;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color:#16e5bb;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
<?php
if($_SERVER['REQUEST_METHOD'] != 'POST')
{
?>
<br>
<div>
<form method="POST" action="">
Category name: <input type="text" name="cat_name" required /><br><br>
Category description: <textarea name="cat_description" required/></textarea><br><br>
<input type="submit" value="Add category" />
</form>
<div>
<?php
}
else
{
$cat_name=$_POST['cat_name'];
$cat_description=$_POST['cat_description'];
$sql = "INSERT INTO categories(cat_name, cat_description)
VALUES('$cat_name' , '$cat_description' ) ";
$result = mysql_query($sql);
if(!$result)
{
echo 'Error' . mysql_error();
}
else
{
echo 'New category successfully added.';
}
}
?>