mosHTML::idBox

Last reviewed: Not reviewed
phpDocumentor

mosHTML::idBox

Builds the HTML code for a standard selectable checkbox for use on a database list-select screen.

Syntax

string idBox ( integer $row_index, integer $record_id [, boolean $enable [, string $name ]] )

$row_index
is the index number of the HTML table row.
$record_id
is the database record index number.
$enable
is a flag.  If false then the method will return an empty string.  This parameter is optional and if omitted will default to false.
$name
is name of the HTML form field.  This parameter is optional and if omitted will default to 'cid'.

Examples

Example: Display a list of records from a database query with standard selection checkboxes.  Note that in this example the table row class is alternated between "row0" and "row1" so as to get the striped effect.  Only the id and title fields are shown in this example.
// $rows returned from a database query.
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  $row = $rows[$i];
  ?>
  <tr class="<?php echo "row$k"; ?>">
    <td width="20">
    <?php echo mosHTML::idBox( $i, $row->id ); ?>
    </td>
    <td>
    <?php echo $row->title; ?>
    </td>
  </tr>
  <?php
  $k = 1 - $k;
}

Please report any errors on this page to the Developer Documentation Forum.


Last Updated ( Saturday, 03 September 2005 )