Super late edit (IMPORTANT): Please NEVER use this question as a tutorial of any sort. The examples shown here are an absolute nightmare open to any attack. I am unable to delete the question but do yourself a favor and close this tab. If you put some parts of the PHP code provided here your website is open to the simplest SQL injection -- if you manage to make it run because the methods shown here were deprecated even at the time of this question being asked. The accepted answer has all of the possible dangers for your website if you put this code in any page. Thanks.
Everything I want is a input with value of a MySQL row:
<?php
ob_start();
session_start();
require_once 'dbconnect.php';
$results = mysqli_query($con,"Select * FROM users WHERE userName ='$username'");
while ($name = mysqli_fetch_array($results))
{
extract($row);
}
// if session is not set this will redirect to login page
if( !isset($_SESSION['user']) ) {
header("Location: index.php");
exit;
}
// select loggedin users detail
$res=mysql_query("SELECT * FROM users WHERE userId=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
You just have logged in, so now you can go to your personal folder:<br>
<?php
if (isset($_POST['bt']))
{
header("Location: http://yougle.rf.gd/" . $_POST['folder']);
}
?>
<html>
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="folder" id="folder" value=<?php echo $name[userName] ?>>
<input type="submit" name="bt" id="bt" value="Go To" />
</form>
</body>
</html>
<?php ob_end_flush(); ?>
And as you can see i have the form... But the field is empty... I've checked all the varibles (is it the same in the DB) and everything seems okay.