When you login to your account, your homepage welcomes yuo with your first & surname.
Then it is supposed to show you your bio ($row "bio" in tbl) and show you a url in an iframe ($row "your website" in tbl).
Problem is, the iframe is not showing the data (url) that is in the "your website" in tbl.
I tried escaping, switching to single quote from double but no luck.
What do you think is wrong ?
Code: Select all
<html>
<head>
<title>
$user Home Page
</title>
</head>
<body>
<body background=".png">
<?php
session_start();
require "conn.php";
/*Check if user is logged-in or not by checking if session is set or not.
If user is not logged-in then redirect to login page. Else, show user's account homepage.php.*/
if(!isset($_SESSION["user"]))
{
header("location:login.php");
}
else
{
$user = $_SESSION["user"];
$sql = "SELECT * FROM users WHERE Username = '".$user."'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
$db_id = $row["Id"];
$db_username = $row["Username"];
$db_forename = $row["Forename"];
$db_surname = $row["Surname"];
$db_email = $row["Email"];
$db_bio = $row["Bio"];
$db_your_fav_url = $row["Fav_Url"];
//Welcome user by name.
echo "<center>Welcome <b><h2>$db_forename $db_surname!</center>"?></h2></b>|
<?php
//Display log-out link.
echo "<p align='right'><a href='logout.php'>$user Log Out</a>";?>|</p><br>
<?php
//Display User Bio.
echo "<br><b>Bio:</b><br>
$db_bio";?><br>
<br>
<?php
//Display User's Fav Url in iFrame.?>
<iframe src='$db_your_fav_url'></iframe>
<?php
}
}
?>
</body>
</html>I get error:
[16-Mar-2017 15:29:44 UTC] PHP Notice: Undefined index: Your_Fav_Url in /home/sn/public_html/sn/home.php on line 34