Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once("db_blog.php");
- $res = mysql_query("select `tema_id`, `tema_name` from `tema`"); // выбираем данные для вставеи в select
- $tid = $_GET['tema_id'];
- $id = $_GET['id'];
- $result = mysql_query(" SELECT id, title, zag, anons, text, date, tema FROM articles WHERE id='$id'");
- $row = mysql_fetch_assoc($result);
- if (isset($_POST['save']))
- {
- $p_text = trim($_POST['p_text']);
- $p_tema = strip_tags(trim($_POST['p_tema']));
- mysql_query (" UPDATE news SET text='$p_text', tema='$p_tema' WHERE id='$id' ");
- mysql_close();
- }
- ?>
- <form method="post" action="edit_art.php?id=<?PHP echo $id;?>">
- Текст<br/>
- <textarea cols="40" rows="10" name="p_text"><?php echo $row['text']?></textarea><br/>
- Тема<br/>
- <select name="p_tema" size="1">
- <? while ($row = mysql_fetch_assoc($res)): ?>
- <option value="<?=$row['tema_id'] == $_GET['tema_id']?>"><?=$row['tema_name']?></option>
- <? endwhile;?>
- </select><br/><br/>
- <input type="submit" name="save" value="Сохранить" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement