i hope some kind souls could help me out with this one... i'm more of a designer than a developer so i'm kinda bad at this.
so i have a page inside of a page inside of a page,

basically, i have 2 files


and a folder full of .txt files

in index.php there is

<div id="content"></div>


<script type="text/javascript">
function refreshContent(var1) {

so when user clicks on the menu button, it calls up javascript


to bring the user to the blog page

now, in writings.php, there is a select box for the user to pick the dates

<select id="listText">
$scan = scandir("writings/");
for ($i = 0; $i < count($scan); $i++) {
if ($scan[$i] != "." && $scan[$i] != "..") {
$file = $scan[$i];
settype($file, string);
echo '<option value=' . chr(34) . $file . chr(34) . '>' . $file . '</option>';


<div id="contentText"></div>

and then,

<script type="text/javascript">
function refreshText(var1) {
url : "writings/" + var1,
success : function (data) {
function() {
$("#listText").change(function() {

so, basically the flow is like this
user clicks on menu item, gets to writings page, user selects a writing in the text box, and gets to read the writing
the problem is this, i'd have to put all the html tags in the .txt files
i'd like to use this format to output the txt files so that it will display on the browser just as it would in notepad without having to have the tags in the .txt files itself

i have only one idea on solving this, and that is to make an extra showselected.php file that is called up upon selecting an item in the list
with only this

$file = "file.txt";
$f = fopen($file, "r");
while ( $line = fgets($f, 1000) ) {
print $line . "<br />";

however, i need a way to set a $selectedfile variable in writings.php and pass it to showselected.php so the file.txt will be whatever file was selected in writings.php

i'm not a programmer, and i have no idea how i can execute this, could any kind soul provide me a solution? or maybe a better alternative because i feel i'm doing this in a ridiculous way, oh i need to use AJAX because i don't want the page to be refreshed as index.php is using a motion graphics flash background, i forgot to mention i'm using jquery.js as well, thus the .ajax, there's a reason why i used .load in index.php and then .ajax to load in another, its because of some bugs which i forgot what it was about.

i thank anyone who could help me out, hope to receive some replies,