-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_data.php
More file actions
executable file
·30 lines (28 loc) · 815 Bytes
/
Copy pathpost_data.php
File metadata and controls
executable file
·30 lines (28 loc) · 815 Bytes
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
<?php
$servername = "localhost";
$username = "root";
$password = "123";
$database="app_login";
//data login
// Create connection
$conn = mysqli_connect($servername, $username, $password,$database);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}else{
$title=$_POST['title'];
$text_user=$_POST['text_post'];
$category=$_POST['category'];
if(!empty($title) && !empty($text_user) && !empty($category)){
$query="INSERT INTO tb_information (title,text_user,category) VALUES ('$title','$text_user','$category')";
$result = mysqli_query($conn, $query);
if ($result) {
include "admin.php";
}else {
echo"can not insert data";
}
}else {
echo"<script> alert('you must to input data');</script";
include "admin.php";
}
}
?>