0

I am trying to load text into a form (textarea) from an existing text file resident on the server. I am having no luck. The code I am using (with variations) is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title>SVP Data</title>
<link rel="stylesheet" href="main.css"/>
</head>
<body style="background-color:#FFFFFF">
<title>oakhurstsvp.org</title>
<link href="../twoColLiqLtHdr.css" rel="stylesheet" type="text/css" style="background-color:white"/>
<h1><div align="left">
<img src="../images/SVP Header.jpg" width="966" height="158" /> 
</div></h1>
<form>
<textarea id="comments" name="comments" cols="90" rows="5" style="font-size:12pt;border:double;background:#FFC">
<?php
$handle = fopen ("../images/comments.txt", "r+");
$mytextfile = get_file_contents('$handle');
echo $mytextfile
?>
</textarea>
</form>
</body>
</html>

What am I doing wrong?

Edited by pritaeas: Fixed markdown.

3
Contributors
2
Replies
8
Views
11 Months
Discussion Span
Last Post by kingwash
0
//loop through your table like this

<?php
$con = mysqli_connect("localhost","servername","dbn","pwd");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to Database: " . mysqli_connect_error();
  } 
$sql = "SELECT *FROM tbl";

$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {

     // student_detail table
     $mg=$row['mg'];    

            }
    }

    ?>
    <textarea> <?php echo $mg?></textarea> //text display in textarea
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.