Skip to content
Permalink
1fc184b196
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
39 lines (33 sloc) 1.08 KB
<?php
session_start();
include 'db_conn.php';
$sr = "localhost";
$username = "root";
$password = "";
$dbname = "test_db";
$connect = mysqli_connect($sr,$username,$password,$dbname);
if (isset($_POST['submit']))
{
if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['role']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$role = $_POST['role'];
$pass = $_POST['password'];
$pass = password_hash($pass, PASSWORD_DEFAULT);
$query = "insert into users(full_name, email, role, password) values('$name', '$email', '$role', '$pass')";
$run = mysqli_query($connect,$query);
if ($run)
{
$_SESSION['status'] = "Employee Added";
header("Location: manage.php");
}else {
$_SESSION['status'] = "Employee Not Added";
header("Location: manage.php");
}
}else
{
$_SESSION['status'] = "All fields require";
header("Location: manage.php");
}
}