I have a textarea in HTML where a logged in user can enter and save notes. I use the following script to retrieve the saved notes from the database
<?php
function notes() {
$password = "fake_password";
$connect = mysql_connect("localhost", "user", $password) or die("Couldn't connect to the database!");
mysql_select_db("db_name") or die("Couldn't find the database!");
$query = mysql_query("SELECT * FROM users WHERE notes!=''");
$numrows = mysql_num_rows($query);
if ($numrows != 0) {
while ($row = mysql_fetch_assoc($query)){
$notes = $row['notes'];
}
echo $notes;
}
}
?>
That works all fine and dandy but now - how do I save the changes the user made to the notes (textarea) when a Save button is clicked?
EDIT:
Here is the form itself:
<div class="row-fluid">
<div class="span12">
<br />
<center><textarea class="input-xxlarge" rows="15"><?php include('includes/func.php'); notes(); ?></textarea>
<br />
<button class="btn btn-primary">Save Changes</button>
</center>
</div>
</div>