Hi there.
Perhaps a straight forward matter...
I have created a simple website CMS using text files.
The text files contain the site content and are uploaded via a form.
I want to have a dropdown menu in the form so that the user can a) browse their HD for the text file, then b) choose from a dropdown menu the page that this file apply to. This is so that anyone can edit the site without having to know the text file names.
I have the following form:
<form action="../admin/index.php" method="post" enctype="multipart/form-data" >
<p>
<input type="file" name="myfile">
</p>
<p>
<select name="whichreplace">
<option selected>Select Page To Edit/Replace</option>
<option value="home.txt">Home</option>
<option value="menuMain.txt">Main Menu</option>
<option value="menuFinger.txt">Finger Food</option>
<option value="menuChristmas.txt">Christmas Menu</option>
<option value="menuNewYear.txt">New Year Menu</option>
<option value="menuFinger.txt">Finger Food</option>
<option value="location.txt">Location</option>
<option value="functions.txt">Functions</option>
<option value="events.txt">Events</option>
</select>
</p>
<p>
<input type="submit" value="Upload File">
</p>
</form>
Beyond this I have a manual file rename script:
<?
rename("/home/httpd/vhosts/domain.com/httpdocs/test/data/".$u->file['name']."","/home/httpd/vhosts/domain.com/httpdocs/test/data/home.txt");
?>
which renames the file to home.txt. Obviously this is a bit clunky. Essentially the file name should be the value of the 'whichreplace' option in the dropdown menu.
Your help would be most appreciated.