Demonstration
Second demo
Open the notepad
Enter the first program
o <?php
o include('connection.php');
First demo o $uname=$_POST['uname'];
o $password=$_POST['password'];
Go to localhost/phpmyadmin o
o {
Open xampp o
Create database o echo "Login successfully.";
Create table with 2 columns o $_SESSION['log'] = 1;
o header("refersh:2;url=libmanan.php");
o Username(varchar100) o }
o Password(varchar6) o
Go to c drive o ?>
Open xampp folder Save the files to the recent created folder (in the first demo)
After that open the notepad and enter :
Go to htdocs o <?php
Create new folder o session_start();
Open notepad o ?>
o <!DOCTYPE html>
Then enter: o <html>
o <?php o <head>
o $serverName ="localhost"; o <title>Login</title>
o $userName="root"; o </head>
o $password=""; o <body>
o <h3>Login</h3>
o $dbname="jaja_db"; o <form method="POST" action="login.php">
o Enter username : <input type="text"
o //create connection name="uname"><br><br>
o Enter Password : <input type="password"
name="password"><br><br>
o $con = mysql_connect($serverName, o <input type="submit" value="Login">
$userName, $password, $dbname); o
o </form>
o if(mysqli_connect_errno()){ o
o echo"error!"; o </body>
o </html>
o exit(); o <?php
o session_destroy();
o } o ?>
o echo "Connection Successfully!"; Save the file to the folder
Go to search bar
o ?> Enter localhost/name of the folder then enter.
Then save the files to the created folder(ex.
Index.php)
Go to search bar
Enter localhost/name of the folder then enter.
3rd Demo o <meta http-equiv="X-UA-Compatible"
content="IE=edge">
Go to localhost/phpmyadmin o <meta name="viewport"
Open xampp content="width=device-width, initial-
Create database scale=1.0">
Go to c drive o <title>Demo Update</title>
Open xampp folder o
o <?php include('./include.php'); ?>
Go to htdocs
o <!-- bootstrap link / sweet alert -->
Create new folder o </head>
Open notepad o <body>
Then enter the first code: o <br><br><br><br>
o <?php o <div class="container w-50" >
o $servername = "localhost"; o <div
o $username = "root"; class="card"style="background-color:
o $password = ""; #c9c9c7;">
o $dbname = "updatedemo"; o <div class="card-header bg-
success">
o // Create connection o <center><h2 >SAMPLE
o $conn = new mysqli($servername, UPDATE EMAIL AND
$username, $password, $dbname); PASSWORD</h2></center> <br>
o // Check connection o
o if ($conn->connect_error) { o </div>
o die("Connection failed: " . $conn- o <div class="card-body">
>connect_error); o <table class="table table-
o } striped">
o ?> o <thead class="bg-success">
Then save the files to the created folder(ex. o <tr>
Index.php) o <th>ID</th>
Enter the 2nd code: o <th>EMAIL</th>
o <link o <th>PASSWORD</th>
href="https://cdn.jsdelivr.net/npm/bootstr o <th>ACTION</th>
[email protected]/dist/css/bootstrap.min.css" o
rel="stylesheet" integrity="sha384- o </tr>
1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94 o </thead>
WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" o
crossorigin="anonymous"> o <tbody>
o <!-- JavaScript Bundle with Popper --> o <?php
o <script o if ($accounts->num_rows
src="https://cdn.jsdelivr.net/npm/bootstra > 0) {
[email protected]/dist/js/bootstrap.bundle.min.js" o
integrity="sha384- o while($account =
ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMh $accounts->fetch_object()) {
uP+IlRH9sENBO0LRn5q+8nbTov4+1p" o ?>
crossorigin="anonymous"></script> o <tr>
o <script o <th name ="id"><?php
src="//cdn.jsdelivr.net/npm/sweetalert2@1 echo $account->id; ?></th>
1"></script> o <th><?php echo
Then save the files to the created folder: $account->email; ?></th>
Enter the 3rd code: o <th><?php echo
o <?php $account->password; ?></th>
o require('./config.php'); o <th> <a
o $accounts = $conn->query('select * from href="view.php?id=<?php echo $account-
account'); >id ?> " type="submit" class="btn btn-
o ?> primary">view</a></th>
o o
o o
o o </tr>
o o <?php
o <!DOCTYPE html> o
o <html lang="en"> o
o <head> o }
o <meta charset="UTF-8"> o }else
o { o $email = $_POST['email']; // selected
o ?> account email
o o $password = $_POST['password'];//
<center>>>>>>>>>>>Nothing to selected account password
Display<<<<<<<<</center> o $confirm = $_POST['confirm'];// confirm
o <?php password
o } o if($password != $confirm)// once the
o ?> password is mismatch with the confirm
o password will be redirect to home index with
o </tbody> message success = false
o o {
o </table> o header('Location:index.php?success='.
o <center>>>end<<</center> 'false' );
o </div> o }else{// password match
o </div> o $result =
o </div> mysqli_query($conn,"UPDATE account SET
o email ='".$email."', password =
o </body> '".$password."' WHERE id = '".$id."'; ");
o </html> o //a query that will update the selected
o id. email and password will be updated
o <?php according to the form
o o //
o if(isset($_GET['success'])) o ?>
o { o <?php
o if($_GET['success']=='true')// success o header('Location:index.php?success='.
message 'true' );// redirect to index with message
o { success = true
o ?> o }
o <script> o
o Swal.fire( o
o 'Success!', o }
o 'Update Successfully!', o ?>
o 'success' The save
o ) Enter the 5th code”
o </script> o -- phpMyAdmin SQL Dump
o o -- version 5.1.1
o <?php o -- https://www.phpmyadmin.net/
o } o --
o else if(($_GET['success']=='false'))//error o -- Host: 127.0.0.1
message o -- Generation Time: Mar 04, 2022 at 10:47
o { AM
o ?> o -- Server version: 10.4.21-MariaDB
o <script> o -- PHP Version: 8.0.11
o Swal.fire( o
o 'Failed!', o SET SQL_MODE =
o 'Failed to update: Please check your "NO_AUTO_VALUE_ON_ZERO";
inputs!', o START TRANSACTION;
o 'error', o SET time_zone = "+00:00";
o ) o
o </script> o
o <?php o /*!40101 SET
o } @OLD_CHARACTER_SET_CLIENT=@@C
o } HARACTER_SET_CLIENT */;
o unset($_GET['success']); o /*!40101 SET
the save @OLD_CHARACTER_SET_RESULTS=@
enter the 4th code: @CHARACTER_SET_RESULTS */;
o <?php o /*!40101 SET
o include './config.php';//connection @OLD_COLLATION_CONNECTION=@@
o if(isset($_POST['submit']))// if the submit COLLATION_CONNECTION */;
button is set o /*!40101 SET NAMES utf8mb4 */;
o { o
o $id = $_GET['id'];// selected account id o --
o -- Database: `updatedemo`
o -- Save the file (ex. Php.sql)
o Enter the 6th code:
o -- -------------------------------------------------- o <?php
------ o require('./config.php');//connection
o o
o -- o $result =$conn->query('select * from
o -- Table structure for table `account` account where id ='. $_GET['id']);// select
o -- all from account where id match
o o $account =mysqli_fetch_object($result);//
o CREATE TABLE `account` ( account selected specific row
o `id` int(11) NOT NULL, o // i use fetch object for to maximize
o `email` varchar(100) NOT NULL, readabilty
o `password` varchar(100) NOT NULL o ?>
o ) ENGINE=InnoDB DEFAULT o
CHARSET=utf8mb4; o <!doctype html>
o o <html lang="en">
o -- o <head>
o -- Dumping data for table `account` o <meta charset="utf-8">
o -- o <meta name="viewport"
o content="width=device-width, initial-
o INSERT INTO `account` (`id`, `email`, scale=1">
`password`) VALUES o <meta name="description" content="">
o (1, '
[email protected]', '2345'), o <meta name="author" content="Mark
o (2, '
[email protected]', 'maria'), Otto, Jacob Thornton, and Bootstrap
o (3, '
[email protected]', '12345'), contributors">
o (4, '
[email protected]', 'qwerty'), o <meta name="generator" content="Hugo
o (5, '
[email protected]', 0.88.1">
'juandelacruz'), o <title>Sample Update</title>
o (6, '
[email protected]', 'flores'); o
o o <?php include('./include.php'); ?>
o -- o <!-- bootstrap link / sweet alert -->
o -- Indexes for dumped tables o </head>
o -- o <body class="text-center">
o o <br><br><br><br><br><br>
o -- <br><br><br>
o -- Indexes for table `account` o <div class="container w-50"
o -- style="background-color:#ede0bb;">
o ALTER TABLE `account` o <!-- go to update that has selected account
o ADD PRIMARY KEY (`id`), id -->
o ADD UNIQUE KEY `email` (`email`); o <!-- with selected account id to be updated
o at update.php -->
o -- o <form action="./update.php?id=<?php echo
o -- AUTO_INCREMENT for dumped tables $account->id; ?>" method="POST"
o -- id="form">
o o <center><h3>SAMPLE
o -- UPDATE</h3></center>
o -- AUTO_INCREMENT for table `account` o <div class="form-group row">
o -- o <label for="staticEmail" class="col-sm-2
o ALTER TABLE `account` col-form-label">ID</label>
o MODIFY `id` int(11) NOT NULL o <div class="col-sm-10">
AUTO_INCREMENT, o <input type="text" readonly class="form-
AUTO_INCREMENT=7; control-plaintext" value="<?php echo
o COMMIT; $account->id ?>">
o o </div>
o /*!40101 SET o </div>
CHARACTER_SET_CLIENT=@OLD_CHA o
RACTER_SET_CLIENT */; o <div class="form-group row">
o /*!40101 SET o <label for="inputPassword" class="col-
CHARACTER_SET_RESULTS=@OLD_CH sm-2 col-form-label">Update
ARACTER_SET_RESULTS */; Email</label>
o /*!40101 SET o <div class="col-sm-10">
COLLATION_CONNECTION=@OLD_COL o <input type="email" required
LATION_CONNECTION */; name="email" class="form-control"
placeholder="Email" value="<?php echo
$account->email ?>" >
o </div>
o </div>
o <div class="form-group row">
o <label for="inputPassword" class="col-
sm-2 col-form-label">Password</label>
o <div class="col-sm-10">
o <input type="password" required
name="password" class="form-
control"placeholder="Password">
o </div>
o </div>
o <div class="form-group row">
o <label for="inputPassword" class="col-
sm-2 col-form-label">Confirm
Password</label>
o <div class="col-sm-10">
o <input type="password" required
name="confirm" class="form-control"
placeholder="Confirm Password">
o </div>
o </div>
o <button type="submit" value="submit"
name="submit" class="btn btn-
primary">UPDATE</button>
o <!-- submit button -->
o <a href="./index.php" class="btn btn-
secondary"> Go back</a>
o <!-- button to return to home index.php -->
o </form>
o </div>
o
o
o
o </body>
o </html>
o <?php
The save the file
Go to search bar
Enter localhost/name of the folder then enter.
4th demo
"for connecting to the database" how to run: -
go to your Windows (C;)
go to xampp
go to htdocs -and create new folder named
("CONNECTION")
Enter the code
then inside CONNECTION folder copy paste the
o <?php
three files (connect.php, index.html, style.css) –
o
open up your xampp Control Panel –
o $username = filter_input(INPUT_POST,
start Apache –
'username');
start MySQL –
o $password = filter_input(INPUT_POST,
go to admin of MySQL -type "localhost" -then
click "CONNECTION" folder 'password');
o
"for Complete CRUD Process" how to run: - o if (!empty($username)) {
go to your Windows (C;) o if (!empty($password)) {
go to xampp o $host = "localhost";
go to "htdocs" o $dbusername = "root";
and create new folder named ("php_crud") o $dbpassword = "";
then inside "php_crud" folder create another o $db_name = "form_db";
folders named ("css", "Database File", o
"includes") -in "css" folder copy the file named o // Create connection
(style.css) – o $conn = new mysqli ($host,
in "Database File" folder copy the file named $dbusername, $dbpassword,
(php_crud.sql) – $db_name);
in "includes" folder copy the files named o if (mysqli_connect_error()) {
(create.php, delete.php, home.php, update.php, o die ('Connect Error (' .
view.php) mysqli_connect_errno(). ')' .
in "php_crud" folder copy the last three files mysqli_connect_error());
named (db.php, header.php, index.php) o }
Note: ung last three files sa labas po ng css, o else {
Database File, and includes folder
o $sql = "INSERT INTO form_db
(username, password) values
('$username', '$password')";
to run this: -go to your xampp -open up control o if ($conn->query($sql)) {
panel -start Apache -start MySQL -go to the o echo "Connected
admin of MySQL -click new tab -type localhost - Successfully!";
then click "php_crud" folder
o echo "<h1 style =
'margin:200px'><center>New record
In the connection folder
successfully inserted!</center></h1>";
o }
o else {
o echo "Error: " . $sql . "<br>" .
$conn->error;
o }
o $conn->close(); o <input type="password"
o } name="password"
o } autocomplete="off">
o else { o </label> <br/><br/>
o echo "<h1 style = o
'margin:200px'><center>Password o <label for="submit">
should not be empty!</center></h1>"; o <input type="submit"
o } value="Login">
o } o </label>
o else { o </form>
o echo "<h1 style = o
'margin:200px'><center>Username o
should not be empty!</center></h1>"; o </body>
o die(); o
o } o </html>
o ?> Save in format as name.html
Then save to connection o *{
o <!DOCTYPE html> o box-sizing: border-box;
o <html lang="en"> o }
o o
o <head> o body {
o <meta charset="UTF-8"> o background: aqua;
o <meta http-equiv="X-UA-Compatible" o }
content="IE=edge"> o
o <meta name="viewport" o form {
content="width=device-width, initial- o padding-top: 120px;
scale=1.0"> o text-align: center;
o <link rel="stylesheet" o font-size: 30px;
href="style.css"> o }
o <title>Form Site</title> o
o </head> o input {
o o width: 250px;
o <body> o height: 40px;
o o font-size: 30px;
o <form method="POST" o }
action="connect.php"> o
o <h2>Simple Login Form</h2> o input[type=submit] {
o <label for="username"> o background: rgb(19, 240, 19);
o Username: o }
o <input type="text"
name="username" autocomplete
="off">
o </label> <br/><br/>
o
o <label for="password">
o Password:
o Db.php o <link rel="stylesheet"
o <?php href="https://cdn.jsdelivr.net/npm/boo
o //server with default setting (user 'root'
[email protected]/font/bootstrap-
with no password) icons.css">
o $host = 'localhost'; // server o <title>PHP CRUD System</title>
o $user = 'root'; o </head>
o $pass = ""; o <body>
o $database = 'login_crud'; //Database o INDEX.PHP
Name o <!-- Header -->
o o <?php include "header.php" ?>
o // establishing connection o <style><?php include
o $conn = 'C:/xampp/htdocs/php_crud/css/style.c
mysqli_connect($host,$user,$pass,$dat ss'; ?></style>
abase); o <!-- body -->
o o <div class="container mt-5">
o // for displaying an error msg in case o <h1 class="text-center"> Welcome,
the connection is not established Let's Perform CRUD Process</h1>
o if (!$conn) { o <p class="text-center">
o die("Connection failed: " . o (Create, Read, Update, Delete)
mysqli_connect_error()); o </p>
o } o <div class="container">
o ?> o <form action="includes/home.php"
o method="post">
o Header.PHP o <div class="from-group text-
o <?php include "db.php" ?> center">
o <!DOCTYPE html> o <input type="submit" class="btn
o <html lang="en"> btn-primary mt-2" value="Start Here">
o <head> o </div>
o <meta charset="UTF-8"> o </form>
o <meta http-equiv="X-UA-Compatible" o </div>
content="IE=edge"> o </div>
o <meta name="viewport"
content="width=device-width, initial-
scale=1.0">
o
o <!-- Bootstrap CSS -->
o <link
href="https://cdn.jsdelivr.net/npm/boo
[email protected] beta3/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr Code:
8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous"> o -- phpMyAdmin SQL Dump
o o -- version 5.0.2
o <!-- Bootstrap Icon --> o -- https://www.phpmyadmin.net/
o -- o INSERT INTO `users` (`id`, `username`,
o -- Host: 127.0.0.1 `email`, `password`) VALUES
o -- Generation Time: Jun 06, 2021 at 01:34 o (31, 'Robin', '
[email protected]',
PM 'Robin95will'),
o -- Server version: 10.4.11-MariaDB o (32, 'Chris ', '
[email protected]',
o -- PHP Version: 7.4.6 'chris@rock'),
o o (33, 'Charlie', '
[email protected]',
o SET SQL_MODE = 'charlie1234'),
"NO_AUTO_VALUE_ON_ZERO"; o (34, 'Andy', '
[email protected]',
o START TRANSACTION; 'andy@66');
o SET time_zone = "+00:00"; o
o o --
o o -- Indexes for dumped tables
o /*!40101 SET o --
@OLD_CHARACTER_SET_CLIENT=@@CHAR o
ACTER_SET_CLIENT */; o --
o /*!40101 SET o -- Indexes for table `users`
@OLD_CHARACTER_SET_RESULTS=@@CHA o --
RACTER_SET_RESULTS */; o ALTER TABLE `users`
o /*!40101 SET o ADD PRIMARY KEY (`id`);
@OLD_COLLATION_CONNECTION=@@COL o
LATION_CONNECTION */; o --
o /*!40101 SET NAMES utf8mb4 */; o -- AUTO_INCREMENT for dumped tables
o o --
o -- o
o -- Database: `php_crud` o --
o -- o -- AUTO_INCREMENT for table `users`
o o --
o -- -------------------------------------------------------- o ALTER TABLE `users`
o o MODIFY `id` int(12) NOT NULL
o -- AUTO_INCREMENT, AUTO_INCREMENT=36;
o -- Table structure for table `users` o COMMIT;
o -- o
o o /*!40101 SET
o CREATE TABLE `users` ( CHARACTER_SET_CLIENT=@OLD_CHARACT
o `id` int(12) NOT NULL, ER_SET_CLIENT */;
o `username` varchar(255) NOT NULL, o /*!40101 SET
o `email` varchar(255) NOT NULL, CHARACTER_SET_RESULTS=@OLD_CHARAC
o `password` varchar(255) NOT NULL TER_SET_RESULTS */;
o ) ENGINE=InnoDB DEFAULT o /*!40101 SET
CHARSET=utf8mb4; COLLATION_CONNECTION=@OLD_COLLATI
o ON_CONNECTION */;
o --
o -- Dumping data for table `users`
o --
o
<div class="form-group">
<label for="user" class="form-
label">Username</label>
<input type="text" name="user"
class="form-control" required
autocomplete = "off">
</div>
o Create.php
<!-- Header -->
<div class="form-group">
<?php include "../header.php" ?>
<label for="email" class="form-
<style><?php include
label">Email ID</label>
'C:/xampp/htdocs/php_crud/css/style.css';
<input type="email" name="email"
?></style>
class="form-control" required
<?php
autocomplete = "off">
if(isset($_POST['create']))
</div>
{
$user = $_POST['user'];
<div class="form-group">
$email = $_POST['email'];
<label for="pass" class="form-
$pass = $_POST['pass'];
label">Password</label>
<input type="password" name="pass"
// SQL query to insert user data into
class="form-control" required
the users table
autocomplete = "off">
$query= "INSERT INTO users(username,
</div>
email, password)
VALUES('{$user}','{$email}','{$pass}')";
<div class="form-group">
$add_user =
<input type="submit" name="create"
mysqli_query($conn,$query);
class="btn btn-primary mt-2"
value="submit">
// displaying proper message for the
</div>
user to see whether the query executed
</form>
perfectly or not
</div>
if (!$add_user) {
echo "something went wrong ".
<!-- a BACK button to go to the home page
mysqli_error($conn);
-->
}
<div class="container text-center mt-5">
<a href="home.php" class="btn btn-
else { echo "<script
warning mt-5"> Back </a>
type='text/javascript'>alert('User added
<div>
successfully!')</script>";
o Delete.php
}
<!-- Footer -->
}
<?php include "../header.php" ?>
?>
<?php
<h1 class="text-center">Add User details
if(isset($_GET['delete']))
</h1>
{
<div class="container">
<form action="" method="post">
<th scope="col" colspan="3"
$userid= $_GET['delete']; class="text-center">CRUD Operations</th>
</tr>
</thead>
<tbody>
// SQL query to delete data from user <tr>
table where id = $userid
$query = "DELETE FROM users WHERE <?php
id = {$userid}"; $query="SELECT * FROM users";
$delete_query= mysqli_query($conn, // SQL query to fetch all table data
$query); $view_users=
header("Location: home.php"); mysqli_query($conn,$query); // sending
the query to the database
} // displaying all the data retrieved
from the database using while loop
?>
while($row=mysqli_fetch_assoc($view_user
<!-- Footer --> s)){
<?php include "footer.php" ?> $id = $row['id'];
o Home.php $user = $row['username'];
$email = $row['email'];
$pass = $row['password'];
<!-- Header -->
<?php include "../header.php"?> echo "<tr >";
<style><?php include echo " <th scope='row' >{$id}</th>";
'C:/xampp/htdocs/php_crud/css/style.css'; echo " <td > {$user}</td>";
?></style> echo " <td > {$email}</td>";
echo " <td >{$pass} </td>";
<div class="container">
<h1 class="text-center" >Data to perform echo " <td class='text-center'> <a
CRUD Operations</h1> href='view.php?user_id={$id}' class='btn
<a href="create.php" class='btn btn- btn-primary'> <i class='bi bi-eye'></i>
outline-dark mb-2'> <i class="bi bi-person- View</a> </td>";
plus"></i> Create New User</a>
echo " <td class='text-center' > <a
<table class="table table-striped table- href='update.php?edit&user_id={$id}'
bordered table-hover"> class='btn btn-secondary'><i class='bi bi-
<caption>Student Info</caption> pencil'></i> EDIT</a> </td>";
<thead class="table-dark">
<tr> echo " <td class='text-center'> <a
<th scope="col">ID</th> href='delete.php?delete={$id}' class='btn
<th scope="col">Username</th> btn-danger'> <i class='bi bi-trash'></i>
<th scope="col">Email</th> DELETE</a> </td>";
<th scope="col"> Password</th> echo " </tr> ";
}
?> if(isset($_POST['update']))
</tr> {
</tbody> $user = $_POST['user'];
</table> $email = $_POST['email'];
</div> $pass = $_POST['pass'];
<!-- a BACK button to go to the index page - // SQL query to update the data in user
-> table where the id = $userid
<div class="container text-center mt-5"> $query = "UPDATE users SET username =
<a href="../index.php" class="btn btn- '{$user}' , email = '{$email}' , password =
warning mt-5"> Back </a> '{$pass}' WHERE id = $userid";
<div> $update_user = mysqli_query($conn,
$query);
o Update.php echo "<script
<!-- Footer --> type='text/javascript'>alert('User data
<?php include "../header.php"?> updated successfully!')</script>";
<style><?php include }
'C:/xampp/htdocs/php_crud/css/style.css'; ?>
?></style>
<h1 class="text-center">Update User
<?php Details</h1>
// checking if the variable is set or not and <div class="container ">
if set adding the set data value to variable <form action="" method="post">
userid <div class="form-group">
if(isset($_GET['user_id'])) <label for="user" >Username</label>
{ <input type="text" name="user"
$userid = $_GET['user_id']; class="form-control" value="<?php echo
} $user ?>">
// SQL query to select all the data from </div>
the table where id = $userid
$query="SELECT * FROM users WHERE <div class="form-group">
id = $userid "; <label for="email" >Email ID</label>
$view_users= <input type="text" name="email"
mysqli_query($conn,$query); class="form-control" value="<?php echo
$email ?>">
while($row = </div>
mysqli_fetch_assoc($view_users)) <small id="emailHelp" class="form-text
{ text-muted"></small>
$id = $row['id'];
$user = $row['username']; <div class="form-group">
$email = $row['email']; <label for="pass" >Password</label>
$pass = $row['password']; <input type="password" name="pass"
} class="form-control" value="<?php echo
$pass ?>">
//Processing form data when form is </div>
submitted
<div class="form-group"> // SQL query to fetch the data
<input type="submit" name="update" where id=$userid & storing data in
class="btn btn-primary mt-2" view_user
value="update"> $query="SELECT * FROM users
</div> WHERE id = {$userid} ";
</form> $view_users=
</div> mysqli_query($conn,$query);
<!-- a BACK button to go to the home while($row =
page --> mysqli_fetch_assoc($view_users))
<div class="container text-center mt-5"> {
<a href="home.php" class="btn btn- $id = $row['id'];
warning mt-5"> Back </a> $user = $row['username'];
<div> $email = $row['email'];
o View.php $pass = $row['password'];
<!-- Header -->
<?php include '../header.php'?> echo "<tr >";
<style><?php include echo " <td >{$id}</td>";
'C:/xampp/htdocs/php_crud/css/style.css'; echo " <td > {$user}</td>";
?></style> echo " <td > {$email}</td>";
echo " <td >{$pass} </td>";
<h1 class="text-center">User Details</h1> echo " </tr> ";
<div class="container"> }
<table class="table table-striped table- }
bordered table-hover"> ?>
<thead class="table-dark"> </tr>
<tr> </tbody>
<th scope="col" >ID</th> </table>
<th scope="col">Username</th> </div>
<th scope="col">Email</th>
<th scope="col"> Password</th> <!-- a BACK Button to go to pervious page
</tr> -->
</thead> <div class="container text-center mt-5">
<tbody> <a href="home.php" class="btn btn-
<tr> warning mt-5"> Back </a>
<div>
<?php
// first we check using 'isset()
function if the variable is set or not'
//Processing form data when form
is submitted
if (isset($_GET['user_id'])) {
$userid = $_GET['user_id'];