|
|
 |
 |
 |
|
(Since version FH3 v1.2.11)
addJunctionTable |
addJunctionTable (
string |
$sTable |
string |
$sDestinationField |
string |
$sSourceField |
) |
Arguments:
Name |
Description |
$sTable |
The name of the junction table |
$sDestinationField |
Foreign key to the table |
$sSourceField |
Foreign key to the id of this form |
Description:
Add a table and the fields for a junction table
Makes it possible to save data in a junction table instead of comma-separated values.
Example
<?
$oForm = new dbFormHandler();
$oForm->dbInfo( DB_NAME, 'table', DB_TYPE );
$oForm->dbConnect( DB_HOST, DB_USER, DB_PASS );
$oForm->textField( 'Name', 'name' );
// get items from an other table as checkbox
$oForm->dbCheckBox( 'Select items', 'item_id', 'tbl_items', array( 'id', 'item' ) );
// add the junction table
$oForm->addJunctionTable( 'tbl_table_has_item', 'item_id', 'table_id' );
$oForm->onSaved( 'FH_SAVE' );
$oForm->submitButton( );
$oForm->flush( );
?>
|
Latest change: 01 March 10 / 22:03
Comments
|
|
|
|