I have an text type input in a form, and I want the value to hold the contents of a .txt file. This is the relevant code I wrote:
<?php
$filename = "thought.txt";
$fd = fopen ($filename, "r");
$data = fread($fd, 50);
?>
then a little way down:
<?php
echo "<input type=text size=37 name=thought value=$data>";
?>
Now, my problem is, as soon as there is a space in the text file, the value stops there. So if the file was to hold the string "This is the value" then all that would appear in the box is "This."
It's really puzzling me, can anyone help me? Thanks.
-Crisp