Permalink
Browse files

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

  • Loading branch information...
1 parent 76adec1 commit e1b434b129403855e51a742c7cd86a4ba7a382c5 danmarsden committed Jun 27, 2005
Showing with 4 additions and 4 deletions.
  1. +3 −3 mod/choice/lib.php
  2. +1 −1 mod/choice/view.php
View
@@ -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
@@ -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]) ) {

0 comments on commit e1b434b

Please sign in to comment.