php_pracownia-programowania/add.php
2018-12-30 00:24:27 +00:00

18 lines
453 B
PHP

<?php
session_start();
$db_servername = 'localhost';
$db_login_tasks = '';
$db_password_tasks = '';
$db_name_tasks = '';
$db = mysqli_connect("$db_servername", "$db_login_tasks", "$db_password_tasks", "$db_name_tasks");
if (isset($_POST["submit"]) && $_SESSION['zalogowany'] = true) {
$task = $_POST["task"];
$login = $_SESSION['login'];
mysqli_query($db, "INSERT INTO `tasks_$login` (task) VALUES ('$task')");
}
header('Location: index.php');
?>