I am not able to display data to my text area. I'm testing out to display question on textarea and my database structure only have id and question that include one question.
I will appreciate those who will try to give me guidance.
HTML code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<link rel="stylesheet" href="../css/bootstrap.css" />
<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">
<title>Question</title>
</head>
<body>
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<!--<li role="presentation" class="active"><a href="settings.php">Settings</a></li>-->
<li role="presentation"><a href="logout.php">Logout</a></li>
</ul>
</nav>
<h3 class="text-muted">Question App</h3>
</div>
<form action="question.php" method="post">
<tr>
<td><b>Question</b></td>
<br />
<td><textarea name="question" disabled cols="80%" rows="10"></textarea></td>
</tr>
</form>
<footer class="footer">
<p>© 2016 Login App, Inc.</p>
</footer>
</div>
</body>
</html>
PHP code:
<?php
session_start();
require 'database.php';
$records = $conn->prepare("SELECT * FROM `question` WHERE id = 1");
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
?>
your code doesn't try to print the question to the textarea, try
<textarea name="question" disabled cols="80%" rows="10">
<?echo $results['question']?>
</textarea>
assuming question
is the name of your database column