-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_create.php
60 lines (45 loc) · 1.23 KB
/
admin_create.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
<?php
if(isset($_POST['submit'])) {
$title = $_POST['title'];
$blog = $_POST['blog'];
$date = date_create();
$dateFormatted = date_format($date, 'Y-m-d H:i:s');
if(!empty($title) && !empty($blog)) {
$link = mysql_connect('localhost', 'root', '');
mysql_select_db('marina');
$sql = "INSERT INTO blog (Title, Blog, Date) VALUES ('$title', '$blog', '$dateFormatted')";
mysql_query($sql);
mysql_close($link);
$success = true;
} else {
$success = false;
}
}
?>
<html>
<head>
<title>Create Blog | Marina Samuel</title>
<link rel="stylesheet" type="text/css" href="web.css" />
<script type="text/javascript" src="analytics.js"></script>
</head>
<body>
<div id="container">
<div id="admin_create">
<h2>Create Blog</h2>
<div id="form-format">
<form method="post" action="">
<p>Blog Title: </p>
<input type="text" name="title" size="70"/>
<p>Blog: </p>
<textarea name="blog" rows="10" cols="116"></textarea>
<p>
<input type="submit" name="submit"/>
<input type="reset" />
</p>
</form>
</div>
</div>
<div class="clearfix"></div>
</div>
</body>
</html>