I want to create a textbox, which can be edited and shows the text inside the textbox (hope that makes sense). I’ve managed to get the textbox and I have a submit button and everything. Since, however, I am still in the learning process with php and scripting, I don’t know how I can then make this field show whatever was written. At the moment, whatever I type and submit vanishes when submitted (I know why that is, just not how to get the entered text to save to a txt file on the database or something.) Any help would be greatly appreciated.
This is basically the whole script I have:
<?php
session_start();
include_once("include.inc.php");
incHeader();
// make sure staff only are here
newbouncer(2);
// include forum code
include_once("forum-code.php");
mysql_query("UPDATE online SET location = 'My Preferences' WHERE userid = '" . $userID . "'") or die(mysql_error());
echo "</span></p>
</span>
<center><img src=\"/layout/images/notepad.png\"></center><p>
";
?>
<center><form action="/notes.php" method="post">
<textarea name="comments" id="comments" style="width:380px;height:481px; padding:25px ;background:url('http://i686.photobucket.com/albums/vv221/LilyLoganBing/scrollnotes.png'); border:1px #000000">
To-Do's:
</textarea><br>
<input type="submit" value="Submit"></center>
<?php
incFooter();
?>
When you submit the form, the text inside the textarea is stored in
$_POST['comments'].After submission, you can do what ever you like.
Example how to store it in a MYSQL database. Put this piece of code in your form processing script, the script that will run after the submit button is pressed.
To put the text in your MYSQL db back in te textarea use this: