Bug #3623 - doesn't like when $value = 0

This commit is contained in:
danmarsden 2005-06-27 00:58:24 +00:00
parent 1c58f4402c
commit af834f3e7c
2 changed files with 5 additions and 5 deletions

View File

@ -70,7 +70,7 @@ function choice_add_instance($choice) {
foreach ($choice as $name => $value) {
if (strstr($name, "newoption")) { /// New option
$value = trim($value);
if ($value) {
if (isset($value) && $value <> '') {
$option = NULL;
$option->text = $value;
$option->choiceid = $choice->id;
@ -110,7 +110,7 @@ function choice_update_instance($choice) {
$value = trim($value);
if (strstr($name, "oldoption")) { // Old option
if ($value) {
if (isset($value) && $value <> '') {
$option = NULL;
$option->id = substr($name, 9); // Get the ID of the answer that needs to be updated.
$option->text = $value;
@ -122,7 +122,7 @@ function choice_update_instance($choice) {
delete_records("choice_options", "id", substr($name, 9));
}
} else if (strstr($name, "newoption")) { /// New option
if ($value) {
if (isset($value)&& $value <> '') {
$option = NULL;
$option->text = $value;
$option->choiceid = $choice->id;

View File

@ -3,7 +3,7 @@
require_once("../../config.php");
require_once("lib.php");
$id = required_param('id',0,PARAM_INT); // Course Module ID
require_variable($id); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@ -147,7 +147,7 @@
}
$maxans = $choice->maxanswers[$optionid];
if ($text) {
if (isset($text)) {
echo "<td align=\"center\" valign=\"top\">";
echo "<input type=\"radio\" name=\"answer\" value=\"".$optionid."\" ".$answerchecked[$optionid]." alt=\"".strip_tags(format_text($text))."\"";
if ($choice->limitanswers && ($countanswers >= $maxans) && !($answerchecked[$optionid]) ) {