<?php
 
 
class TextBox extends Form_Element
 
{
 
    // description: Use for example with class_textbox.php, class_selectbox.php.
 
    //              Show a textbox filled with database-field.
 
    // version:     1.1
 
        // history:     13-02-2002 release first version
 
    //              20-08-2002 debuginfo gone.
 
 
    var $Connection = 0;
 
    var $SQL_Update_Query;
 
    var $SQL_Show_Query;
 
    var $Type = "text";
 
 
    function TextBox($Name)
 
    {
 
        $this->Set_Element_Name($Name);
 
    }
 
 
    function Show()
 
    {
 
        if ($this->Connection != 0)
 
        {    
 
            // update record
 
            if (!empty($this->SQL_Update_Query))
 
            {
 
                odbc_exec($this->Connection,$this->SQL_Update_Query);
 
            }
 
 
            // get rescent field-value from database
 
            $result = odbc_exec($this->Connection,$this->SQL_Show_Query);
 
            if (odbc_fetch_row($result))
 
            {
 
                $Show_Value = odbc_result($result,1);
 
                $Value_String = " value='".$Show_Value."'";
 
            }        
 
        }
 
        else
 
        {
 
        }
 
        
 
        // show textbox
 
        if (!empty($Value_String)) print"<input type=".$this->Type." name='".$this->Element_Name."'".$Value_String.">\n";
 
        else
 
        print"<input type=".$this->Type." name='".$this->Element_Name."'>\n";
 
    }
 
}
 
 
 
?>
 
 
 |