I have tried to figure out a way to this but I can't get it working let me include all my code here.
mysite.php contains this array
//This is an array of all pages w/out
// the .php3 extension. You should
// place these in the array in the
// order you'd like the menu to be
// generated.
$site_pages = array ("main",
"about",
"method",
"services", "hosting" "contact", "port", "jobs"
);
// This is an array of page titles.
// e.g. ALT text. You should place
// these in the array corresponding
// to the order of the $site_pages
// array.
$site_titles = array ("home",
"about us",
"methodology",
"services", "web hosting",
"contact us",
"portfolio",
"jobs"
);
$page = getenv ("SCRIPT_NAME");
$page .= basename ($page);
This is where I am getting my pages from for my array in myadmin.php Next let me show you all my code for myadmin.php
<script language=javascript>
<!-- hide from older browsers
function publish() {
document.admin.submit();
}
// unhide -->
</script>
<?
include ("config_theme.php");
include ("mysite.php");
echo"<table width =400 border =0><tr><td>";
echo"<form name=admin action=$PHP_SELF method=post enctype=multipart/form-data> ";
echo "<select name=pages onChange=publish(this.form)>";
for ($i = 0; $i < count ($site_titles); $i++)
echo " <option value= $site_pages[$i].txt>$site_titles[$i]</option>";
echo " <option value= main.txt selected>choose a page</option>";
echo "</select>";
echo"</td></tr><tr><td>";
$filename=$pages;
if ($filename == ""){ echo "";}
else {
$fp = fopen($filename, "r");
$content .= fread( $fp, filesize( $filename ));
fclose($fp);
echo "<textarea type =hidden name=pagetext cols=50 rows=25 value=$content ></textarea>";
echo"</td></tr></table>";
echo"</form>";}
echo"<input type=submit name=Submit value=Submit>";
?>
Now let me explain the Big Picture. What I envision is we have a admin page to update all the content on the site. I am using Fast Templates and have txt files for the content of each page. So main.phtml has a text file main.txt for the content. So far I have been able to add a dropdown menu to myadmin.php. When I select a page it open the text file. ie I select home it opens main.txt because the value for home is main.txt. Next Since I have gotten this far I would like to update the text file from one page myadmin.php I have spent hours trying to figure this out and just can't get it to work right. So if anyone could please help. I know I need to use fwrite to accomplish this. I am a newbie to php and have only been using for about 2 weeks. I hope I have covered all basis. I just need some help with the fwrite part of the code. Thanks in advanced!