if (isset($_GET['method'])) { guar_proc($options = array('method' => $_GET['method'], 'id' => $_GET['id'])); } ?> <table class="table table-striped table-hover "> <thead> <tr> <th>ID</th> <th>Текст</th> <th>Действие</th> </tr> </thead> <tbody> <?php foreach (guar_proc($options = array('method' => 'list')) as $row) { ?> <tr class="info"> <td><?php echo $row['id']; ?> </td> <td><?php echo $row['guar']; ?> </td> <td><a href="index.php?page=edit&items=guar&method=del&id=<?php echo $row['id']; ?> ">Удалить / <a href="index.php?page=edit&items=guaredit&id=<?php echo $row['id'];
<?php $guar_array = guar_proc($options = array('method' => 'info', 'id' => $_GET['id'])); if (isset($_POST['send'])) { if (!empty($_POST['content'])) { $content = $_POST['content']; guar_proc($options = array('method' => 'edit', 'content' => $content, 'id' => $_GET['id'])); //Сохраняем гарантию } } ?> <form class="form-horizontal" method="post"> <fieldset> <legend>Редактирование</legend> <div class="form-group"> <label for="textArea" class="col-lg-2 control-label">Тект гарантии</label> <div class="col-lg-10"> <textarea class="form-control" rows="8" id="textArea" name="content"><?php echo $guar_array['guar']; ?> </textarea> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <input type="submit" class="btn btn-primary" name="send" value="Сохранить"> </div> </div> </fieldset> </form>
<?php if (isset($_POST['send'])) { if (!empty($_POST['content'])) { $content = $_POST['content']; guar_proc($options = array('method' => 'add', 'content' => $content)); //Добавляем гарантию } } ?> <div class="col-md-9"> <div class="well"> <form class="form-horizontal" method="post"> <fieldset> <legend>Добавление новой гарантии</legend> <div class="form-group"> <label for="textArea" class="col-lg-2 control-label">Тект гарантии</label> <div class="col-lg-10"> <textarea class="form-control" rows="8" id="textArea" name="content"></textarea> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <input type="submit" class="btn btn-primary" name="send" value="Добавить"> </div> </div> </fieldset> </form> </div> </div>