<form method="post"
      action="<?php echo $action; ?>"
      class="<?php echo ($action == 'tbl_create.php' ? 'create_table' : 'append_fields'); ?>_form ajax lock-page">
    <?php echo PMA_URL_getHiddenInputs($form_params); ?>
    <input type="hidden"
           name="primary_indexes"
           value="<?php if (! empty($_REQUEST['primary_indexes'])) {
                      // happens when an index has been set on a column,
                      // and a column is added to the table creation dialog
                      //
                      // this contains a JSON-encoded string
                      echo htmlspecialchars($_REQUEST['primary_indexes']);
                    } else echo '[]'; ?>">
    <input type="hidden"
           name="unique_indexes"
           value="<?php if (! empty($_REQUEST['unique_indexes'])) {
                      echo htmlspecialchars($_REQUEST['unique_indexes']);
                    } else echo '[]'; ?>">
    <input type="hidden"
           name="indexes"
           value="<?php if (! empty($_REQUEST['indexes'])) {
                      echo htmlspecialchars($_REQUEST['indexes']);
                    } else echo '[]'; ?>">
    <input type="hidden"
           name="fulltext_indexes"
           value="<?php if (! empty($_REQUEST['fulltext_indexes'])) {
                      echo htmlspecialchars($_REQUEST['fulltext_indexes']);
                    } else echo '[]'; ?>">
    <input type="hidden"
           name="spatial_indexes"
           value="<?php if (! empty($_REQUEST['spatial_indexes'])) {
                      echo htmlspecialchars($_REQUEST['spatial_indexes']);
                    } else echo '[]'; ?>">

    <?php if ($action == 'tbl_create.php'): ?>
        <div id="table_name_col_no_outer">
            <table id="table_name_col_no">
                <tr class="vmiddle floatleft">
                    <td><?php echo __('Table name'); ?>:&nbsp;
                    <input type="text"
                           name="table"
                           size="40"
                           maxlength="64"
                           value="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
                           class="textfield" autofocus required />
                    </td>
                    <td>
                        Add
                        <input type="number"
                               id="added_fields"
                               name="added_fields"
                               size="2"
                               value="1"
                               min="1"
                               onfocus="this.select()" />
                        column(s)
                        <input type="button"
                               name="submit_num_fields"
                               value="<?php echo __('Go'); ?>" />
                    </td>
                </tr>
            </table>
        </div>
    <?php endif; ?>
    <?php if (is_array($content_cells)): ?>
        <?php echo PMA\Template::get(
            'columns_definitions/table_fields_definitions'
        )->render(array(
            'is_backup' => $is_backup,
            'fields_meta' => $fields_meta,
            'mimework' => $mimework,
            'content_cells' => $content_cells
        )); ?>
    <?php endif; ?>
    <?php if ($action == 'tbl_create.php'): ?>
        <table>
            <tr class="vtop">
                <th>
                    <?php echo __('Table comments:'); ?>
                </th>
                <td width="25">&nbsp;</td>
                <th>
                    <?php echo __('Collation:'); ?>
                </th>
                <td width="25">&nbsp;</td>
                <th>
                    <?php echo __('Storage Engine:'); ?>
                    <?php echo PMA_Util::showMySQLDocu('Storage_engines'); ?>
                </th>
                <td width="25">&nbsp;</td>
                <th>
                    <?php echo __('Connection:'); ?>
                    <?php echo PMA_Util::showMySQLDocu('federated-create-connection'); ?>
                </th>
            </tr>
            <tr>
                <td>
                    <input type="text"
                           name="comment"
                           size="40"
                           maxlength="60"
                           value="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']): ''); ?>"
                           class="textfield" />
                </td>
                <td width="25">&nbsp;</td>
                <td>
                    <?php echo PMA_generateCharsetDropdownBox(
                        PMA_CSDROPDOWN_COLLATION,
                        'tbl_collation',
                        null,
                        isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null,
                        false
                    ); ?>
                </td>
                <td width="25">&nbsp;</td>
                <td>
                    <?php echo PMA_StorageEngine::getHtmlSelect(
                        'tbl_storage_engine',
                        null,
                        (isset($_REQUEST['tbl_storage_engine']) ? $_REQUEST['tbl_storage_engine'] : null)
                    ); ?>
                </td>
                <td width="25">&nbsp;</td>
                <td>
                    <input type="text"
                           name="connection"
                           size="40"
                           value="<?php echo (isset($_REQUEST['connection']) ? htmlspecialchars($_REQUEST['connection']) : ''); ?>"
                           placeholder="scheme://user_name[:password]@host_name[:port_num]/db_name/tbl_name"
                           class="textfield"
                           required="required" />
                </td>
            </tr>
            <?php if (PMA_Partition::havePartitioning()): ?>
                <tr class="vtop">
                    <th>
                        <?php echo __('PARTITION definition:'); ?>
                        &nbsp;
                        <?php echo PMA_Util::showMySQLDocu('Partitioning'); ?>
                    </th>
                </tr>
                <tr>
                    <td>
                        <textarea name="partition_definition"
                                  id="partitiondefinition"
                                  cols="<?php echo $GLOBALS['cfg']['TextareaCols']; ?>"
                                  rows="<?php echo $GLOBALS['cfg']['TextareaRows']; ?>"
                                  dir="<?php echo $GLOBALS['text_dir']; ?>">

                            <?php echo (isset($_REQUEST['partition_definition']) ? htmlspecialchars($_REQUEST['partition_definition']) : ''); ?>

                        </textarea>
                    </td>
                </tr>
            <?php endif; ?>
        </table>
        <br />
    <?php endif; ?>
    <fieldset class="tblFooters">
        <input type="button"
               class="preview_sql"
               value="<?php echo __('Preview SQL') ?>" />
        <input type="submit"
               name="do_save_data"
               value="<?php echo __('Save'); ?>" />
    </fieldset>
    <div id="properties_message">
    </div>
</form>
