Closed trace-me closed 7 years ago
my code is the following:
<form action="<?php ($_SERVER["PHP_SELF"]);?>" method="post">
<div> <label for="txtEditor">Notitie:</label> <textarea class="form-control" id="txtEditor" name="txtEditor" ></textarea> </div> <br> <button type="submit" name="submit" class="btn btn-success"><i class="fa fa-check" aria-hidden="true"></i> Toevoegen</button> </form> </p>
<?php
$title = $_POST["title"]; $note = $_POST["note"];
if ($_SERVER['REQUEST_METHOD'] == "POST"){ include '../database/connector.php'; $conn = new mysqli($db_servername, $db_username, $db_password, $db_name); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO notities (title, note, gebruiker, date) VALUES ('$title', '$note', '$user_id', '$date_today')"; if ($conn->query($sql) === TRUE) { echo ""; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close();
}
?>
but can't save to my sql database. things although title is saved
my code is the following:
<form action="<?php ($_SERVER["PHP_SELF"]);?>" method="post">
<?php
$title = $_POST["title"]; $note = $_POST["note"];
}
but can't save to my sql database. things although title is saved