so i have a form for adding users I want to put a toast notification on form submission
public function add_user()
{
if(isset($_POST['add_user']))
{
$fullname = $_POST['fullname'];
$username = $_POST['username'];
$password = $_POST['password'];
$access = $_POST['access'];
if($this->check_user_exist($username) == 0)
{
$connection = $this->openConnection();
$stmt = $connection->prepare("INSERT INTO users_tbl(`fullname`, `username`, `password`, `access`, `date_added`) VALUES(?,?,?,?,now())");
$stmt->execute([$fullname, $username, $password, $access]);
echo header ("Location: users.php");
}else{
echo ("User already exist!");
echo header ("Location: users.php");
}
}
}
and I just call it in the beginning of the form so that when the user click the button save it will call the function
<?php
require_once('db/opms_db.php');
$users=$store->getUsers();
$store->add_user($_POST);
$store->update_user($_POST);
$store->delete_user($_POST);
$userdetails = $store->get_userdata();
if(isset($userdetails)){
if($userdetails['access'] !="Admin"){
header("Location: login.php");
}
}else{
header("Location: login.php");
}
?>
I am new to php can somebody help me how to use toast notification and how can i call it? thank you so much