-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.php
More file actions
35 lines (28 loc) · 789 Bytes
/
validate.php
File metadata and controls
35 lines (28 loc) · 789 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
31
32
33
34
35
<html>
<body>
Title: <?php echo $_POST["title"]; ?><br>
Description: <?php echo $_POST["description"];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mysql";
$input1 = $_POST['title'];
$input2 = $_POST['description'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully <br>";
$sql = "INSERT INTO list (title, description) VALUES ( '$input1' , '$input2' )";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
header( 'Location: http://localhost:8080/' );
?>
</body>
</html>