Results 1 to 2 of 2
Related
-
using javascript to update checkbox values and write output to textarea dynamically Forum: Javascript Forum
Replies: 6 -
Displaying data from database in TEXTAREA of form Forum: ASP Forum
Replies: 2 -
How to Decode the data from Database using database handler? Forum: Search Engine Optimization - SEO - Forum
Replies: 1 -
Dynamically populate a text field after making dropdown menu selection Forum: Website Scripts Forum
Replies: 4
-
11-26-2002, 12:43 PM #1
Is it possible to dynamically populate a textarea with data from a database?
Hello,
I'm trying to re-create a listbox with the textarea element. Is it possible to dynamically populate the textarea with data from a database?. I want the data to list vertically like a listbox.
If this possible, can you please provide an example of how I can go about doing this?.
Thanks,
Ariel
-
11-26-2002, 02:32 PM #2
Sure. Heres an example -
PHP Code:$result = mysql_query("SELECT * FROM league_news ORDER BY ident DESC",$db);
printf("<form method=\"post\" action=\"news_handler.php\">\n");
printf("<select name=\"todelete\">\n");
while ($myrow = mysql_fetch_row($result)) {
printf("<option value=\"%s\"> \n", $myrow[5]);
printf("%s\n", $myrow[0]);
printf("</option>\n");
}
print("<input type=\"submit\" value=\"delete\" style=\"padding: 0px; font: 9pt verdana, sans-serif;\">");
printf("</form>");
?>
But the principal is the same. Write the textarea, then a loop from the database echo'ing or printing out what you need. Make sure you put a \n or \r\n character at the end of each to keep them separate.Last edited by QuietDean; 11-26-2002 at 02:35 PM.
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?