<?php
session_start();
$connection = mysqli_connect("localhost", "root", "", "regauth") or die("Error!!!");
if(empty($_SESSION['user']))
header("location: ../../");
if($_GET['link'] === 'logout'){
unset($_SESSION['user']);
session_destroy();
header("location: ../../");
}
// $formdata = filter_input_array(INPUT_POST);
$len=htmlspecialchars(trim($_POST['nameselect']));
// $names = $formdata['nameselect'];
// $names_str = implode(', ', $names);
if(isset($_POST['do-len'])){
mysqli_query($connection, "INSERT INTO users (login,password,name,email,img,len) VALUES ('$login', '$password','$name','$email','$img','$len') ");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Личный кабинет</title>
</head>
<body>
<div><?php echo "Привет, ".$_SESSION['user'][1]; ?> | <a href="index.php?link=logout">Выйти</a>
</div>
<h3>Создание заявки</h3>
<form method="post">
<p><select size="3" name="nameselect" multiple>
<option value="Тест1">Тест1</option>
<option value="Тест2">Тест2</option>
<option value="Тест3">Тест3</option>
</select></p>
<p><input type="submit" name="do-len"value="Отправить"></p>
</form>
<h3>Просмотр своих записей на курсы</h3>
<?php
$sql = mysqli_query($connection, "SELECT * FROM users WHERE `len` = '$len'");
$result = $sql->fetch_all();
var_dump($result);