forked from aswinzz/SocialRevolution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newissue.php
45 lines (36 loc) · 1.21 KB
/
newissue.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
<?php
if(isset($_POST['submit'] )){
$title = ($_POST['title']);
$author = ($_POST['author']);
$location = ($_POST['location']);
$description = ($_POST['description']);
$phone = ($_POST['phone']);
}
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db1";
$tbname = "issues";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
date_default_timezone_set('Asia/Calcutta');
$date = date('Y/m/d H:i:s');
$sql = "INSERT INTO issues ( topic, author, location, description, phone, date) VALUES ('$title', '$author', '$location', '$description', '$phone', '$date')";
if ($conn->query($sql) === TRUE) {
echo '<script language="javascript">';
echo 'alert("created Successfully. Click ok")';
echo '</script>';
header("Refresh: 1; url=dashboard.php");
}
else{
echo '<script language="javascript">';
echo 'alert("OOps Error! Try again")';
echo '</script>';
header("Refresh: 1; url=dashboard.php");
}
$conn->close();
?>