Page 1 of 1

Return data to textarea

Posted: Sat Oct 24, 2009 2:53 am
by ardan16
Hi all can someone tell me if this is possible or if I need different syntax.
the first 3 work and return info, but can you get info to textarea where it is from a medium text field.

Code: Select all

$query = "SELECT name, phone, dept, desc2 FROM report WHERE id=$id";        
$result = @mysql_query ($query); // Run the query.
 
if (mysql_num_rows($result) == 1) { // Valid user ID, show the form.
 
    // Get the user's information.
    $row = mysql_fetch_array ($result, MYSQL_NUM);
    
    // Create the form.
    echo '<h2>Edit a Report</h2>
<form action="one.php" method="post">
<p>Name: <input type="text" name="name" size="15" maxlength="15" value="' . $row[0] . '" /></p>
<p>Phone: <input type="text" name="phone" size="15" maxlength="30" value="' . $row[1] . '" /></p>
<p>Department: <input type="text" name="dept" size="20" maxlength="40" value="' . $row[2] . '"  /> </p>
<p>Report: <textarea name="desc2"  value="' . $row[3] . ' "></textarea> </p>
<p><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted" value="TRUE" />
<input type="hidden" name="id" value="' . $id . '" />
</form>';

Re: Return data to textarea

Posted: Sun Oct 25, 2009 8:31 am
by markusn00b
The textarea HTML element does not have a value attribute. Any text to be shown in the textarea is put between the textarea tags.

Code: Select all

<textarea>this is the textarea's value</textarea>
Mark.

Re: Return data to textarea

Posted: Sun Oct 25, 2009 2:46 pm
by ardan16
Thanks Markus,
That worked

Re: Return data to textarea

Posted: Sun Oct 25, 2009 3:13 pm
by markusn00b
ardan16 wrote:Thanks Markus,
That worked
No problem.

Mark.