diff --git a/lib/weblib.php b/lib/weblib.php
index a23cfc7d50f..859be138ca9 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -3023,7 +3023,8 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
$mincols = 65;
$minrows = 10;
-
+ $str = '';
+
if (empty($courseid)) {
if (!empty($course->id)) { // search for it in global context
$courseid = $course->id;
@@ -3037,9 +3038,9 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
if ($usehtmleditor) {
if (!empty($courseid) and isteacher($courseid)) {
- $str = ($scriptcount < 1) ? ''."\n" : '';
+ $str .= ($scriptcount < 1) ? ''."\n" : '';
} else {
- $str = ($scriptcount < 1) ? ''."\n" : '';
+ $str .= ($scriptcount < 1) ? ''."\n" : '';
}
$str .= ($scriptcount < 1) ? ''."\n" : '';
$scriptcount++;