Advertisement
Guest User

updatepost.php

a guest
Dec 19th, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1.   <?php
  2.  
  3.     $sql="SELECT * FROM quotes ORDER BY quotes .`id` DESC";
  4.     $result=mysql_query($sql);
  5.  
  6.     $show = isset($_GET['show']);
  7.    
  8.     if ($show == '1') {
  9.       while($rows=mysql_fetch_array($result)) {
  10.       ?>
  11.          
  12.     <div class="box">
  13.      
  14.       <div class="tbar"> <?php echo "#" . $rows['id'] . " - " . $rows['datetime']; ?></div>
  15.       <div class="comment"> <?php echo nl2br(htmlspecialchars($rows['comment'])); ?></div>
  16.       <div class="bbar"</div>
  17.       <div class="edit"><a href='add.php?action=updatepost&edit=<?php echo $rows['id']; ?>'>Edit</a></div>
  18.     </div>
  19.       <br>
  20.    
  21.   <?php
  22.  
  23.     }
  24.   }
  25.     $action = $_GET["action"];
  26.     $edit = $_GET['edit'];
  27.     $id = $_GET['edit'];
  28.     //$comment = $_POST['comment']);
  29.     $sql = mysql_query("SELECT comment, id FROM quotes WHERE id=$id");
  30.  
  31.     //echo $comment;
  32.    
  33.    
  34.  
  35.  
  36.     //if ($edit) {
  37.       while($rows = mysql_fetch_assoc($sql)) {
  38.            
  39.     ?>
  40.    
  41.     <div class="form">
  42.     <form id="form1" name="form1" method="post" action="add.php?action=submitedit&id=<?php echo $id; ?>">
  43.           <textarea name="comment" cols="65" rows="6" id="comment"><?php echo $rows['comment']; ?></textarea>
  44.             <input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" />
  45.     </form>
  46.     </div>
  47.  
  48.   <?php
  49.  
  50.           if ($action == 'submitedit') {
  51.           //echo "Success";
  52.           echo $_POST["comment"];
  53.  
  54.  
  55.       }
  56.     }
  57.   //}
  58.   ?>  
  59.  
  60. <!doctype html>
  61. <html lang="da">
  62.  
  63.   <head>
  64.     <title>#uplink</title>
  65.     <meta http-equiv="Content-Type" content="text/html; charset=utf8_genral_ci" />
  66.     <link rel="stylesheet" type="text/css" href="../style/index_style.css" />
  67.   </head>
  68.  
  69.   <body>
  70.  
  71.  
  72.   </body>
  73.  
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement