Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (isset($_GET['news-edit'])) {
- $id = $_GET['news-edit'];
- $sql = mysql_query("
- SELECT *, news.id AS newsid
- FROM news
- JOIN users ON (users.id=news.uid)
- WHERE news.id = '$id' LIMIT 1") or die(mysql_error());
- while($news = mysql_fetch_array($sql))
- echo '<div class="article2">
- <div class="story2">
- <h4 class="title">Ändring av '.$news['title'].'</h4>
- <p><form method="post">Titel: <br /><input name="title" type="text" value="'.$news['title'].'"><br />
- Bild: <br /><input name="img" type="text" value="'.$news['img'].'"><br />
- Inledande Text: <br /><textarea rows="10" cols="80" name="pretext">'.$news['pretext'].'</textarea><br />
- Texten: <br /><textarea rows="10" cols="80" name="text">'.$news['text'].'</textarea></p>
- <input type="submit" value="update" class="login" name="update" />
- </form>
- </div>
- </div>';
- if($_POST[update]) {
- $title = htmlspecialchars($_POST['title']);
- $pretext = htmlspecialchars($_POST['pretext']);
- $text = htmlspecialchars($_POST['text']);
- $img = htmlspecialchars($_POST['img']);
- $date = date("y-n-d");
- $uid = $_SESSION["user_id"];
- $update = mysql_query("UPDATE news SET title = '$title', pretext = '$pretext', text = '$text', date ='$date', uid ='$uid', img = '$img' WHERE id = '$id' LIMIT 1");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement