Entry
How do I display text retrieved from a database in a text area, so the user can modify the text and save the changes?
Jul 13th, 2000 11:05
Ben Udall, Mark Statham, Onno Benschop,
// Ok, first let's say the text to edit is stored in $msg
// Forward slashes are often used to escape certain
// characters in a database, you'll have to remove those
$msg = stripslashes($msg);
// Other characters such as angle brackets <> can mess
// with the html, these need to be converted to their
// equivalent html codes to display properly
$msg = htmlentities($msg);
// Now you create the text area
print("<TEXTAREA name=\"new_msg\" cols=\"40\" rows=\"10\">");
print("$msg</TEXTAREA>\n");
// The php script called by the form submit, will contain the
// modified text in the $new_msg variable, which can then be
// used to update the database