<?php

defined('_MAILING') or die('Restricted access');

/**
 * for example purposes only, table ".PREF."_example_table not exist in the system
 * you have to create table if you want use it
 *
 *
 * example code to get data from ".PREF."_example_table table
 *
$stmt = $db->prepare(" select * from ".PREF."_example_table where id=? ");
$id = (int)($_GET['id']);
$stmt->bindParam(1, $id, PDO::PARAM_INT);
$stmt->execute();
$row = $stmt->fetchAll();
$data = $row[0];

$field1 = $data['field1'];
$field2 = $data['field2'];

*/

$field1 = 'field1';
$field2 = 'field2';

?>
<div class="page-title">
    <div class="title_left">
        <h3>Example title <small>(example subtitle)</small></h3>
    </div>
</div>
<div class="clearfix"></div>

<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <div class="x_title">
                <h2>Editing data form</h2>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <form class="form-horizontal" action="index.php?manage=example_component&data=modify&action=update" method="post">
                    <input type="hidden" name="csrf_token" value="<?php echo $app->getToken();?>">
                    <input type="hidden" name="id" value="<?php echo $id;?>">
                    <div class="form-group">
                    <label for="field1" class="col-sm-2 control-label">Field 1</label>
                        <div class="col-sm-5">
                            <input 
                                type="text" 
                                class="form-control" 
                                id="field1" 
                                name="field1" 
                                value="<?php echo $field1;?>" 
                                placeholder=""
                                required>
                        </div>
                    </div>
                    <div class="form-group">
                    <label for="field2" class="col-sm-2 control-label">Field 2</label>
                        <div class="col-sm-5">
                            <input 
                                type="text" 
                                class="form-control" 
                                id="field2" 
                                name="field2" 
                                value="<?php echo $field2;?>" 
                                placeholder=""
                                >
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-1">
                            <a href="index.php?manage=example_component&action=list" type="button" class="btn btn-success"><i class="fa fa-frown-o"></i> <?php echo CANCEL;?></a>
                        </div>
                        <div class="col-sm-offset-3 col-sm-1">
                            <button type="submit" class="btn btn-primary"><i class="fa fa-download"></i> <?php echo SAVE;?></button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<p>&nbsp;</p>
