My Hosting provider doesn’t provide a database so I am using a text file to store a blog. I am now attempting to write an editing tool for the blog. I open the text file and build an array and present the data in the form. I have navigation buttons that will index up and down to change the content in the form. I can’t seem to get the global variables to update and refresh the form fields after indexing the array. I will attach a text file example and the PHP below. Any help will be appreciated…
[data.php]
Jimmy 05/19/14 (19:49) When you’re through turn off the lights please.
David 05/19/14 (20:49) I can’t follow what I can’t see.
Blogger Time message
[php][PHP]
$fn = “data.php”;
$fer = fopen($fn, “r”) or die(“Unable to open file!”);
$lines = (fgetcsv($fer,0,"\r")); //creates an array for each blog
fclose($fer);
$count = count($lines);
$data = array();
$ctrow = 3;
$i = 0;
foreach($lines as $value) {
$detail[$i] = explode("\t", $value);
$i++;
}
[/PHP]
Edit the Blog
<input type=“text” name= “name” maxlength=25" value ="<?php echo $detail[$ctrow][0]; ?>">
<textarea cols=45" rows=10" name=thoughts" maxlength=500"><?php echo $detail[$ctrow][2]; ?>