Fixed key word error

This commit is contained in:
neerholt 2021-03-05 10:52:42 +01:00
parent dd66573508
commit e1e879e94b
5 changed files with 44 additions and 12 deletions

View File

@ -19,7 +19,7 @@ if(isset($_POST['login'])){
if(password_verify($password, $hashedPassword )){
$_SESSION['groupName'] = $groupName;
$_SESSION['success'] = "You are now logged in";
header('location: Main.php?login=success');
header('location: ../Frontend/group.php?login=success');
}
}

View File

@ -8,7 +8,7 @@ class KeyWord extends Eloquent{
public function group(){
return $this->hasOne(Group::class);
return $this->belongsTo(Group::class);
}
}

View File

@ -0,0 +1,18 @@
<?php
require "../bootstrap.php";
use Backend\Models\Group;
use Backend\Models\KeyWord;
if(isset($_POST['submitKeyWord'])){
$keyword = new KeyWord();
$keyword->keyWord = $_POST['key_word'];
$keyword->group()->associate(Group::find($_POST['group_id']));
if(!$keyword->save()){
return;
}
}

24
Frontend/group.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/*
require "../bootstrap.php";
*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="../Backend/keyWordsRemaining.php" method="POST">
<input type="text" name="key_word" placeholder="key word">
<input type="number" name="group_id" placeholder="group id">
<input type="submit" name="submitKeyWord" value="Submit">
</form>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>