Здравствуйте, как перенаправить на страницу после нажатие кнопки "сохранить"? Код (Text): function edit() { if($_SESSION['STATUS'] == 'director') { header('Location: /admin/document.php'); exit; } $GLOBALS['back-to-list'] = '<a id="back-to-list" href="/admin/document.php">Вернуться к списку</a>'; $return = ''; $shelf_id = 0; $SQL = "SELECT * FROM ".TABLE_PREFIX."document WHERE id = '".$_REQUEST['id']."'"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); if(mysql_num_rows($qRS) > 0) { $row = mysql_fetch_object($qRS); $GLOBALS['this_action'] = $GLOBALS['module_action'][1]; $SQL = "SELECT * FROM ".TABLE_PREFIX."cell WHERE id = '".$row->cell_id."'"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); $cell = mysql_fetch_object($qRS); } else { $GLOBALS['this_action'] = $GLOBALS['module_action'][2]; } $return = '<form action="/admin/document.php" method="post" enctype="multipart/form-data"> <div id="edit-content"> <div class="title"> <div class="float-left">№ П/П</div> </div> <div class="edit-block"> <div class="float-left"> '.$row->id.' </div> </div> <div class="title"> <div class="float-left">район</div> </div> <div class="edit-block"> <div class="float-left"> <input type="text" class="normal-text" name="department" value="'.stripslashes(htmlspecialchars($row->department)).'" /> </div> </div> <div class="title"> <div class="float-left">№</div> </div> <div class="edit-block"> <div class="float-left"> <input type="text" class="normal-text" name="number_pd" value="'.stripslashes(htmlspecialchars($row->number_pd)).'" /> </div> </div> <div class="title"> <div class="float-left">код</div> </div> <div class="edit-block"> <div class="float-left"> <input type="text" class="normal-text" name="rnn" value="'.stripslashes(htmlspecialchars($row->rnn)).'" /> </div> </div> <div class="title"> <div class="float-left">Ф.И.О</div> </div> <div class="edit-block"> <div class="float-left"> <input type="text" class="normal-text" name="name" value="'.stripslashes(htmlspecialchars($row->name)).'" /> </div> </div> <div class="title"> <div class="float-left">Дата рождения</div> </div> <div class="edit-block"> <div class="float-left"> <input type="text" class="normal-text" name="date" id="date" value="'.((isset($_REQUEST['id'])) ? substr($row->date, 8, 2).'-'.substr($row->date, 5, 2).'-'.substr($row->date, 0, 4) : date('d-m-Y')).'" /> </div> </div> <div class="title"> <div class="float-left">Вид</div> </div> <div class="edit-block"> <div class="float-left"> <select name="pay_type" class="normal-select">'; $SQL = "SELECT * FROM ".TABLE_PREFIX."type ORDER BY title"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { $return .= '<option value="'.$r->id.'"'.(($row->pay_type == $r->id) ? ' selected="selected"' : '').'>'.stripslashes($r->title).'</option>'; } $return .= ' </select> </div> </div> <div class="title"> <div class="float-left">участок</div> </div> <div class="edit-block"> <div class="float-left"> <select name="inspector" class="normal-select">'; $SQL = "SELECT * FROM ".TABLE_PREFIX."inspector WHERE is_deleted <> '1' ORDER BY title"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { $return .= '<option value="'.$r->id.'"'.(($row->inspector == $r->id) ? ' selected="selected"' : '').'>'.stripslashes($r->title).'</option>'; } $return .= ' </select> </div> </div> <div class="title"> <div class="float-left">Статус</div> </div> <div class="edit-block"> <div class="float-left"> <select name="status" class="normal-select">'; $SQL = "SELECT * FROM ".TABLE_PREFIX."status ORDER BY title"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { $return .= '<option value="'.$r->id.'"'.(($row->status == $r->id) ? ' selected="selected"' : '').'>'.stripslashes($r->title).'</option>'; } $return .= ' </select> </div> </div> <div class="title'.(($row->is_given == 1) ? ' not-show' : '').'"> <div class="float-left">Стеллаж</div> </div> <div class="edit-block'.(($row->is_given == 1) ? ' not-show' : '').'"> <div class="float-left"> <select id="shelf_id" name="shelf_id" class="normal-select" onchange="loadShelf(this.value)"> <option value="0">Не выбран</option>'; $SQL = "SELECT * FROM ".TABLE_PREFIX."shelf ORDER BY title"; $qRS = mysql_query($SQL) or die ('<b>Ошибка запроса: </b>'.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { $return .= '<option value="'.$r->id.'"'.(($r->id == $cell->shelf_id) ? ' selected="selected"' : '').'>'.stripslashes($r->title).' (ID: '.$r->id.')</option>'; } $return .= ' </select> </div> </div> <div class="title s-block'.((!$row || $row->is_given == 1 || $row->cell_id == 0) ? ' not-show' : '').'"> <div class="float-left">Полка</div> </div> <div class="edit-block s-block'.((!$row || $row->is_given == 1 || $row->cell_id == 0) ? ' not-show' : '').'"> <div class="float-left"> <select id="s_id" name="s_id" class="normal-select" onchange="loadCell(this.value)">'; if($cell) { $return .= '<option value="0">Не выбрана</option>'; $x = array(); $SQL = "SELECT * FROM ".TABLE_PREFIX."cell WHERE shelf_id = '".$cell->shelf_id."' ORDER BY x"; $qRS = mysql_query($SQL) or die ('Не удалось выполнить: '.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { if(($r->count < $r->places) || ($r->id == $row->cell_id)) { $x[$r->x] = true; } } foreach($x as $key => $val) { $return .= '<option value="'.$key.'"'.(($key == $cell->x) ? ' selected="selected"' : '').'>'.$key.'</option>'; } } $return .= ' </select> </div> </div> <div class="title c-block'.((!$row || $row->is_given == 1 || $row->cell_id == 0) ? ' not-show' : '').'"> <div class="float-left">Ячейка</div> </div> <div class="edit-block c-block'.((!$row || $row->is_given == 1 || $row->cell_id == 0) ? ' not-show' : '').'"> <div class="float-left"> <select id="c_id" name="c_id" class="normal-select">'; $al = getAll(); if($cell) { $return .= '<option value="0">Не выбрана</option>'; $y = array(); $SQL = "SELECT * FROM ".TABLE_PREFIX."cell WHERE shelf_id = '".$cell->shelf_id."' AND x = '".$cell->x."' ORDER BY y"; $qRS = mysql_query($SQL) or die ('Не удалось выполнить: '.$SQL.'<br/>'.mysql_error()); while($r = mysql_fetch_object($qRS)) { if(($r->count < $r->places) || ($r->id == $row->cell_id)) { $y[$r->y] = true; } } foreach($y as $key => $val) { $return .= '<option value="'.$key.'"'.(($key == $cell->y) ? ' selected="selected"' : '').'>'.$al[$key].'</option>'; } } $return .= ' </select> </div> </div> <div class="div100 m-top-10" align="right"> <input type="hidden" name="id" value="'.stripslashes($_REQUEST["id"]).'" /> <input type="hidden" name="action" value="save" /> <input type="hidden" id="not-popup" /> <input type="submit" value="Сохранить" class="button"/> </div> <div class="edit-clear"></div> </div> </form>'; if($row) { $GLOBALS['right_content'] = ' <div class="div100"> <input type="button" value="Распечатать штрих-код" onclick="getBarcode('.$row->id.')" class="button" id="print" /> </div> <div class="clear"></div>'; } return $return; } require("top.php"); require("bottom.php");
Спасибо вроде получилась Код (Text): header('Location: /admin/document.php'); $ret .= '<div class="errorBlack">Сохранено</div>';