Forum Moderators: coopster
I have a text area - notes which reads and writes to database when form is submitted. There is only one record in the database so it looks like this
entry
new entry
future entry
its up to the user to add new lines and add in dates if needed - one save updates the previous saves so you always have the old text on display. (hope this makes sense)
anyways because its set like this its difficult to add in time stamps for each entry (i have a last updated date but thats all) like i said the user would need to add in the date of each entry manually.
What i would like is when the form is displayed to the user - all the previous submitted text is show but a new line is added to the end of file and inserts a date then the user can start typing
now is this possible at all - i have s simple text insert script using javascript so when the user click on a link it inserts a pre defined text into the text area - problem is it over writes anything in there, not good.
// get info from database
echo '<textarea>';
echo $database_info['textarea']."\n";
echo [url=http://uk.php.net/manual/en/function.date.php]date[/url](/* you choose format */)."\n";
echo '</textarea>';
<script type="text/javascript">
function setCursorPos( x ) {
var txtRange = x.createTextRange();
txtRange.moveStart( "character", x.value.length - 0 );
txtRange.moveEnd( "character", 0 );
txtRange.select();
}
</script>
thanks for your help