Creating a Long List in a Form

Chapter 9 Forms

Immediate Solutions

Creating a Long List in a Form

Page 346 describes the creation of a long list in a form and there is one too many dollar signs in the code. The following code:

$parameter["$default"]

should be:

$parameter["default"]

Here is the corrected code:

function form_text($name, $parameter)
   {
   if(!isset($parameter["default"]))
      {
      $parameter["default"] = "";
      }
   if(strlen($parameter["default"]))
      {
      $parameter["default"] = " value=\"" . $parameter["default"]
         "\"";
      }
   return($parameter["question"] . "  "
      . "<input type=\"text\" name=\"" . $name . "\""
      . $parameter["default"] . ">");
   }

Thank you to Joel from Canberra for reporting out the error.