Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $get_post = (int)$_GET['post'];
- $pega_post = mysql_query("SELECT * FROM princi WHERE id = '$get_post'");
- while($linha = mysql_fetch_array($pega_post)){
- ?>
- <h1>Ediçao - <?php echo $linha['titu'];?></h1>
- <div id="editPost">
- <form action="" method="post" enctype="multipart/form-data"/>
- <label>
- <span class="title">Titulo</span>
- <input type="text" name="title" value="<?php echo $linha['titu'];?>"/>
- </label>
- <label>
- <span class="title">Subtitulo</span>
- <input type="text" name="sub" value="<?php echo $linha['subti'];?>"/>
- </label>
- <label>
- <span class="title">Categoria</span>
- <select name="cat"/>
- <?php
- $pega_cats = mysql_query("SELECT id,nome FROM categorias ORDER BY id DESC");
- while($linhas = mysql_fetch_array($pega_cats)){
- ?>
- <option value="<?php echo $linhas['id'];?>" <?php if($linhas['id'] == $linha['categoria']){echo 'selected="selected"';}?>><?php echo $linhas['nome'];?></option>
- <?php }?>
- </select>
- </label>
- <label>
- <textarea name="conteudo" cols="30" rows="5">
- <?php echo $linha['conteudo'];?>
- </textarea>
- </label>
- <input type="hidden" name="acao" value="publicar" />
- <input type="submit" value="Publicar Postagem" class="send"/>
- </form>
- </div><!--- Editar Postagem ---->
- <?php }?>
- <?php if(isset($_POST['acao']) && $_POST['acao'] == 'publicar'){
- $title = strip_tags(trim($_POST['title']));
- $subti = strip_tags(trim($_POST['subti']));
- $categoria = $_POST['cat'];
- $conteudo = htmlentities($_POST['conteudo'], ENT_QUOTES);
- $setPost = mysql_query("UPDATE princi SET titu = '$title',subti = '$subti', categoria = '$categoria', conteudo = '$conteudo' WHERE id = '$get_post'");
- if($setPost){
- echo '<script>alert("Postagem Atualizada com sucesso!");location.href="?pg=editarDesq"</script>';
- }else{}
- }
- ?>
Add Comment
Please, Sign In to add comment