-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewPost.php
More file actions
53 lines (37 loc) · 1.17 KB
/
NewPost.php
File metadata and controls
53 lines (37 loc) · 1.17 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
<?php
global $Title;
global $Content;
global $Author;
if (isset($_POST['upload'])) {
$Title=$_POST['title'];
$Content=$_POST['Body'];
$Author=$_POST['Author'];
$database= "mydb";
$link=mysqli_connect('localhost', 'root',"");
$databasee=mysqli_select_db($link, $database);
$query="INSERT INTO blog (Name , Body , author) VALUES ('$Title' , '$Content' , '$Author')";
$result=mysqli_query($link, $query);
if ($result) {
header('location: home.php');
}
else
{
echo "Failed";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Add New Post</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<form type="NewPost.php" method="POST" >
<input type="text" name="title" placeholder="Enter Post Title Here"><br>
<textarea name="Body" placeholder="Enter Post Content here"></textarea><br>
<input type="text" name="Author" placeholder="Author Name or Email id">
<input type="submit" name="upload" value="Post to forum">
</form>
</body>
</html>