Computing and IT Support Forums

PHP - Another function for HTML class

agoikhman - Aug 07, 2006 - 06:15 PM
Post subject: Another function for HTML class
Simple yet very useful. I started to use this function to put sql result sets into html select box. Thank you. I also added function print_input to this class:

Code:
function print_input($name, $value="", $input_type="TEXT", $js="", $size="", $maxlength="", $checked="", $dsbl="") {

   if (!empty($checked))
      $checked = " " . $checked;

   print ( "<INPUT TYPE=\"" . $input_type . "\" NAME=\"" . $name . "\"" . $checked );

   if ( $value != '' )
      print (" VALUE=\"" . $value . "\"");

   if ( !empty($size) )
      print (" SIZE=\"" . $size . "\"");

   if ( !empty($maxlength) )
      print (" MAXLENGTH=\"" . $maxlength . "\"");

   if ( !empty($dsbl) )
      print (" DISABLED ");

   print ($js . ">\n" );   

}

h8dk97 - Aug 08, 2006 - 11:42 AM
Post subject: RE: Another function for HTML class
Thanks for your feedback. You can add your function to the knowledge base if you like, that way it will be easier for other people to find it if they are looking for something similar.
All times are GMT