Código PHP:
   <?
 
class Contactenos
  {
      //metodos de cabecera
    var $name="form";
    var $method="post";
    //tabla Externa
    var $ewidth = "300";
    var $eborder = "1";
    var $ealign = "center";
    var $ecellpadding = "0";
    var $ecellspacing = "0";
    var $ebordercolor = "#000066";
    var $ebgcolor = "#66FFFF";
    //tabla interna
    var $iwidth = "100%";
    var $iborder = "0";
    var $ialign = "center";
    var $icellpadding = "5";
    var $icellspacing = "4";
    var $ibordercolor = ""; 
    //titulo
    var $tcolspan = "2" ;
    var    $taling = "center" ;
    var    $tstyle = "style1" ;
    var $ttitulo = "ttitulo";
    
   
    function set_head($name,$method)
      
      {
          $this->name=$name;
        $this->method=$method;
      
      }
      
    function set_tabla_externa($ewidth,$eborder,$ealign,$ecellpadding,$ecellspacing,$ebordercolor,$ebgcolor)
    
      {
        $this->ewidth=$ewidth;
        $this->eborder=$eborder;
        $this->ealign=$ealign;
        $this->ecellpadding=$ecellpadding;
        $this->ecellspacing=$ecellspacing; 
        $this->ebordercolor=$ebordercolor; 
        $this->ebgcolor=$ebgcolor; 
 
      }
    function set_tabla_interna($iwidth,$iborder,$ialign,$icellpadding,$icellspacing,$ibordercolor)
      {
      
          $this->iwidth=$iwidth;
        $this->iborder=$iborder;
        $this->ialign=$ialign;
        $this->icellpadding=$icellpadding;
        $this->icellspacing=$icellspacing; 
        $this->ibordercolor=$ibordercolor; 
      }
      
    function set_titulo($ttitulo,$taling,$tstyle)
      {
        $this->taling=$taling;
        $this->tstyle=$tstyle;
        $this->ttitulo=$ttitulo;
      }             
 
    function display ()
    
      {
      //stylo
      echo "<style type='text/css'>";
      echo ".style1 {color: #003399; font-weight:bold }";
      echo "</style>";
      //inicio de formulario
      echo "<form id='";
      echo $this->name;
      echo "' name='";
      echo $this->name;
      echo "' method='";
      echo $this->method;
      echo "' action=''>";
      //inicio de tabla externa
      echo "<table width='";
      echo $this->ewidth;
      echo "' border='";
      echo $this->eborder;
      echo "' align='";
      echo $this->ealign;
      echo "' cellpadding='";
      echo $this->ecellpadding;
      echo "' cellspacing='";
      echo $this->ecellspacing;
      echo "' bordercolor='";
      echo $this->ebordercolor;
      echo "' bgcolor='";
      echo $this->ebgcolor;
      echo "'>";
      echo "<tr>";
      echo "<td>";
      //inicio de tabla interna
      echo "<table width='";
      echo $this->iwidth;
      echo "' border='";
      echo $this->iborder;
      echo "' align='";
      echo $this->ialign;
      echo "' cellpadding='";
      echo $this->icellpadding;
      echo "' cellspacing='";
      echo $this->icellspacing;
      echo "' bordercolor='";
      echo $this->ibordercolor;
      echo "'>";
      //titulo
      echo "<tr>";
      echo "<td colspan='";
      echo $this->tcolspan;
      echo "'><div align='";
      echo $this->taling;
      echo "'><span class='";
      echo $this->tstyle; 
      echo "'>";
      echo $this->ttitulo;
      echo "</span><br />";
      echo " </div></td>";
      echo "</tr>";
 
                 
      } 
  
  }
  
class caja_texto
  {
  
      //metodos de cajas de texto
    var $caja_name ="textfield1";
    var $caja_color ="textfield";
    var $caja_medida ="20";
    var $caja_descripcion ="nombre1";
    var $caja_ancho ="49";
    var $caja_cien = "100";
    var $caja_ancho2 = "";
    
      function set_textfield ($caja_name,$caja_estilo,$caja_medida,$caja_descripcion,$caja_ancho)
      {
        $this->caja_name=$caja_name;
        $this->caja_color=$caja_color;
        $this->caja_medida=$caja_medida;
        $this->caja_descripcion=$caja_descripcion;
        $this->caja_ancho=$caja_ancho;
      } 
    function calculo()
      {
      $caja_ancho2 = $caja_cien - $caja_ancho;
      }  
      
    function display_textfield()
      {
          //estilo
        echo "<style type='text/css'>";
        echo ".textfield { background-color: #FFFFCC; color:#0033CC}";
        echo "</style>";
        //cajas de texto
        echo "<tr>";
        echo "<td width='";
        echo $this->caja_ancho;
        echo "%'>";
        echo $this->caja_descripcion;
        echo "</td>";
        echo "<td width='";
        echo $this->caja_ancho2;
        echo "%'><input name='";
        echo $this->caja_name;
        echo "' type='text' class='";
        echo $this->caja_color;
        echo "' size='";
        echo $this->caja_medida;
        echo "' />";
        echo "</td>";
        echo "</tr>";
 
      }  
  }
  
class Boton
  {
      var $bcolspan ="2";
    var $baling  = "center";
    var $bname ="submit";
    var $btype = "submit";
    var $bstylo = "style1";
    var $bvalue = "submit";
    
 
    
    function set_boton($baling,$bname,$bstylo,$bvalue)
      {
        $this->baling=$baling;
        $this->bname=$bname;
        $this->bstylo=$bstylo;
        $this->bvalue=$bvalue;
      
      }
    function display_boton()
    
     {
         echo "<tr>";
        echo "<td> </td>";
        echo "<td> </td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td colspan='";
        echo $this->bcolspan;
        echo "'><div align='";
        echo $this->baling;
        echo "'>";
        echo "<input name='";
        echo $this->bname;
        echo "' type='";
        echo $this->btype;
        echo "' class='";
        echo $this->bstylo;
        echo "' value='";
        echo $this->bvalue;
        echo "' />";
        echo "</div>";
        echo "</label></td>";
        echo "</tr>";
        echo "</table></td>";
        echo "</tr>";
        echo "</table>";
        echo "</form>";
     
     }       
 
  }  
  
  
  
  $objeto = new Contactenos();
  $textf = new caja_texto();
  $boton = new Boton();
  
  $objeto -> set_titulo("Contactenos","center","style1");
  $textf -> set_textfield ("nombre",".style1","20","nombres","30");
  $objeto -> display();
  $textf -> display_textfield();
  $boton -> display_boton();
  
    
?>     
 



