i'm new to html & php so be nice 😉
What i would like to do is create a notice board that reads text from a file, into a read-only text area form. Then as anyone wishes to update the notices they can click on an update button, be taken to the editable notice text area, make their changes, click save and the text file (with changes) is updated and they are taken back to the read only text area. I am upto writing the updated notices out to the text file. I can't figure out how to read the edited text in the text area to write out to file...Not sure if this is possible.
This is the read only notice page:
<body>
<form name="notice" method="post" action="update.php">
<div align="center">
<textarea name="textarea" cols="80" rows="20" readonly="readonly"><?php
$notice = file( "notice.txt" );
foreach ( $notice as $file )
{
echo $file;
}
?></textarea>
</div>
<div align="center">
<input type="submit" name="button2" value="Update">
</div>
</form>
</body>
This is the updating and saving page:
<body>
<form name="notice" method="POST" action="">
<div align="center">
<textarea name="textarea" cols="80" rows="20"><?php
$notice = file( "notice.txt" );
foreach ( $notice as $file )
{
echo $file;
}
?></textarea>
</div>
<div align="center">
<input type="submit" name="save" value="Save Changes">
</div>
<?php
if(isset($_POST['save']))
{
echo "saving";
$write = fopen("notice2.txt", "w");
?????????????????????
echo "saved";
}
?>
</form>
</body>
thanks in advance