When A user clicks on an edit link for a certain story in profile.php, it takes them to writingforms.php. When writing forms is loaded I want it to load in the info from the DB into the text fields and you can edit it that way. The fields are not loading the info into them how come?
profile.php code snippet:
<? //journal call
$db = mysql_select_db('studiocommunity', $conn)
or die("Unable to access user information in database, try again later.");
$sql = mysql_query('select * from user_writings where user = "' . $_REQUEST['user'] . '"order by id desc') or die(mysql_error());
while($row = mysql_fetch_assoc($sql)) {
stripslashes(extract($row));
echo "<a href='writings.php?id=$id'>" . $title . " - " . date("F d, Y", $date) . "</a> ";
if($HTTP_SESSION_VARS['valid_user'] == $_REQUEST['user'])
{ echo " - [<a href='writingforms.php'>edit</a>] [delete]<br>";
}
}
?>
and writingforms.php
<?
session_start();
include ('dbconnect.php');
function get_story_record($id)
{
$conn = db_connect();
$db = mysql_select_db('studiocommunity', $conn)
or die("Unable to access user information in database, try again later.");
$sql = "select * from user_writings where id = '" . $_REQUEST['id'] . "'";
$result = mysql_query($sql, $conn);
return(mysql_fetch_array($result));
}
if (isset($HTTP_GET_VARS['id']))
$w = get_writing_record($HTTP_GET_VARS['id']);
?>
<center>
<form action="writingsubmit.php" method="post">
<input type="hidden" name="writing" value="<? print $HTTP_GET_VARS['id']; ?>">
<table>
<tr><td align="center">Title</td></tr>
<tr><td><input size="40" name="title" value="<? print $w['title']; ?>"></td></tr>
<tr><td align="center">Writing Text - Can contain HTML text</td></tr>
<tr><td><textarea cols="40" rows="7" name="writing_text" wrap="virtual">
<? print $w['writing']; ?>
</textarea></td></tr>
<tr><td align="center"><input type="submit" value="Submit"></td></tr>
</table>
</form>
</center>
I cannot figure out what is wrong, help please.