05-07-2009, 10:41 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: May 2007
Location: Your G/F's Closet
Posts: 114
Thanks: 7
|
Personal Notes via PHP
So i know i just got help with some update settings from yall but this one is quite different in a way.
I am trying to have a personal notepad in the user/admin dashboard but for some reason it won't update like last time or read the data from the mysql database to post..
Full Code:
http://pastie.org/471693
Code To Read & Post Data To Form:
PHP Code:
$notesquery = mysql_query("SELECT * FROM user WHERE `username` = '$username' && `password` = '$password'") or die(mysql_error());
$notesresult = mysql_fetch_array( $notesquery );
$notes = $notesresult['notes'];
Code To Update/Display Form:
PHP Code:
<?php
if (isset($_POST['submit'])) {
// Define Variables
$notes = $_POST['notes'];
// Attempt To Update
$update = mysql_query("UPDATE user SET `notes` = '".$notes."' WHERE `username` = '$username' && `password` = '$password'") or die(mysql_error());
if($update) {
echo "Success";
}
} else {
?>
<form id="form1" name="form1" method="post" action="">
My Personal Notes<br />
<label class="textarea">
<textarea name="notes" id="notes" rows="6" cols="80"><?php echo $notes ?></textarea>
</label>
<p><small>Any notes that you put in this box are your private notes, Nobody else will be able to see them, so make them as secret as you want.</small></p>
<p>
<input name="submit" id="submit" type="submit" />
</p>
</form>
<?php } ?>
It won't even display the $notes in the form.. nor will it update the mysql database, im not sure whats going on. please help again.
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25 - Andrew Rutherford
|
|
|