Jump to content

Sticky form: text area field not retaining content


peppericious

Recommended Posts

Hello all.

 

I'm new here... and new to php... so please be gentle if I'm overlooking something that's blindingly obvious.

 

I have a 'view blog entries' page and an 'edit blog entries' page. When I go to the 'edit blog entries' page, I want the form fields to display the preexisting blog content for whatever entry I'm about to edit.

 

The code below does display the 'title' but it does not display the 'article' content. (However, the 'title' and 'article' content both show when I view the source code.)

 

Can anyone tell me what I could be doing wrong? Thanks in advance.

 

// Retrieve the blog post's information:
$q = "SELECT title, article FROM entries WHERE article_id=$article_id";		
$r = @mysqli_query ($dbc, $q);

if (mysqli_num_rows($r) == 1) { // Valid blog entry ID, show the form.

// Get the blog entry's information:
$row = mysqli_fetch_array ($r, MYSQLI_NUM);

echo '<form action="edit_entry.php" method="post">

<p>Title:<br />
<input type="text" name="title" size="45" maxlength="80" value="' . $row[0] . '" /></p>
<p>Blog entry<br />
    <textarea name="article" id="article" cols="45" rows="5" ' . $row[1] . '></textarea>
  </p>

<p><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted" value="TRUE" />
<input type="hidden" name="article_id" value="' . $article_id . '" />
</form>';

} else { // Not a valid entry ID.
echo '<p class="error">This page has been accessed in error.</p>';
}
mysqli_close($dbc);		
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.