Hi how can i display user information according to their session after logged in? i would liike to display in text input field , i already create the session and include the dbconfig.php. it doesnt appear in the text input field. Is there something wrong with my mysqli query? Any helps really appreciated..
This is my stdProfile.php
<body>
<?php
// connect to the database
include('dbconfig.php');
// get record from db
$sql = "SELECT id, stdName, stdMatric, stdFaculty, stdPhone from student";
$result = $mysqli-> query($sql);
session_start();
$_SESSION['stdName'] = $stdName;
while($row=mysqli_fetch_assoc($result))
{
$stdName = $row['stdName'];
$stdMatric = $row['stdMatric'];
$stdFaculty = $row['stdFaculty'];
$stdPhone = $row['stdPhone'];
}
?>
<h3 style="margin-left: 1em; margin-top: 1em;text-decoration: underline;">Student Profile</h3>
<div style="margin-left: 1em;">
<div class="form">
<div class="row">
<div class="col-xs-4">
<label>Student Name</label>
<input type="text" class="form-control" name="stdName" value="<?=$row['stdName']?>" readonly>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-4">
<label>Student Matric</label>
<input class="form-control" name="stdMatric" value="<?=$row['stdMatric']?>" readonly>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-4">
<label>Student Faculty</label>
<input class="form-control" name="stdFaculty" value="<?=$row['stdFaculty']?>" readonly>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-4">
<label>Student Phone</label>
<input class="form-control" name="stdPhone" value="<?=$row['stdPhone']?>" readonly>
</div>
</div>
<br />
<button type="button" class="btn btn-danger" onclick="location.href='../view/custHomePage.php?
cust_ID=<?=$_SESSION['cust_ID']?>'">Cancel</button>
<button type="button" class="btn btn-warning" data-toggle="modal" data-
target="#updateModal">Edit Profile</button>
</div>
</div>
</body>
</html>
This is my dbconfig.php
<?php
// server info
$server = 'localhost';
$user = 'root';
$pass = '';
$db = 'userprofile';
// connect to the database
$mysqli = new mysqli($server, $user, $pass, $db);
// show errors
mysqli_report(MYSQLI_REPORT_ERROR);
?>
and this is my output, got error and data not appear in the text field, Really appreciate for the helps..
