JSFiddle - React, Tailwind, and code Playground
HTML
<?php
//start session
session_start();
//Connect to database
$connection = mysqli_connect('localhost', 'root', 'admin', 'eprb');
//check connection
if(!$connection){
//output error
echo 'Connection error: ' . mysqli_connect_error();
}
//check get request id parameter
if(isset($_GET['id'])){
$id = mysqli_real_escape_string($connection, $_GET['id']);
$_SESSION['id'] = $id;
//make sql
$sql ="SELECT * FROM datamurid WHERE IDmurid = $id";
$sql2 ="SELECT * FROM eprb WHERE IDpendaftaran = $id";
//get the query result
$result = mysqli_query($connection, $sql);
$result2 = mysqli_query($connection, $sql2);
//fetch result in array format
$rows = mysqli_fetch_assoc($result);
$rows2 = mysqli_fetch_assoc($result2);
//clear stuff and close connection
mysqli_free_result($result);
mysqli_free_result($result2);
mysqli_close($connection);
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Update</title>
<link href="style.php" rel="stylesheet" type="text/css">
</head>
<body>
<header class="header">
<h1><span class="system">E</span>-<span class="system">P</span>endaftaran <span class="system">R</span>umah <span class="system">B</span>iru</h1>
</header>
<h2 class="welcome">Kemaskini Data EPRB</h2>
<form action="processUpdate.php" method="post" enctype="multipart/form-data" name="update" class="paparan">
<?php if($rows){ ?>
<label for="profile">Gambar profil lama:<br>
</label>
<img src=<?php echo $rows['photo'];?> width="128" height="98" alt=""/>
<?php }else{
echo "<h2 class='center'>";
echo "Data ini tidak lagi wujud di dalam pangkalan data.";
echo "</h2>";
}?>
<?php if($rows && $rows2){ ?>
<p>
<label for="profile">Gambar profil baru:<br></label>
<input name="profile" type="file" form="update" required="required">
</p>
<p>
<label for="name">Nama:</label>
<input name="name" id="name" type="text" required="required" form="update" value= "<?php echo $rows['namaMurid'];...
CSS
<?php Header ("Content-type: text/css; charset=utf-8");?>
@charset "utf-8";
/* CSS Document */
.header {
background-color: rgba(100,100,250,1.00);
font-size: 40px;
text-align: center;
}
body {
background-color: rgba(170,170,170,1.00);
}
.form {
float: right;
}
.error {
text-align: center;
color: rgba(248,0,4,1.00);
background-color: rgba(0,0,0,1.00);
font-size: 20px;
}
.image {
float: left;
}
.welcome {
color: rgba(0,0,255,1.00);
text-align: center;
font-size: 30px;
}
.system {
color: rgba(10,10,200,1.00);
}
.navigation {
background-color: rgba(100,100,250,1.00);
width: 200px;
height: 300px;
font-size: 20px;
float: left;
}
.left {
float: left;
}
.right {
float: right;
}
.navigation a {
color: rgba(9,15,73,1.00);
}
.navigation ul li {
list-style-type: none;
text-transform: uppercase;
text-decoration: underline;
margin-top: 45px;
display: block;
width: 150px;
height: 46px;
}
.navigation a:hover {
background-color: rgba(66,17,208,1.00);
}
.form {
float: right;
margin-right: 500px;
margin-left: 0px;
}
.green {
color: rgba(0,150,0,1.00);
text-align: center;
}
.centreMargin {
float: right;
margin-right: 350px;
background-color: rgba(255,255,255,1.00);
}
.centreMargin2 {
float: right;
margin-right: 300px;
}
.navigation .current {
color: rgba(183,183,253,1.00);
}
.searchBar {
width: 850px;
}
.center {
text-align: center;
}
.paparan {
width: 500px;
margin-left: 500px;
font-size: 20px;
text-align: center;
height: 600px;
margin-right: 0px;
margin-top: 30px;
}
.log {
color: rgba(43,83,245,1.00);
width: 250px;
margin-left: 650px;
}
.good {
background-color: rgba(62,203,19,1.00);
}
.bad {
background-color: rgba(214,31,34,1.00);
}
.neutral {
background-color: rgba(82,106,250,1.00);
}