Advertisement
Guest User

task 155

a guest
Mar 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $host = 'localhost';
  2. $user = 'root';
  3. $password = '';
  4. $db_name = 'test';
  5. $link = mysqli_connect($host, $user, $password, $db_name) or die(mysqli_error($link));
  6.  
  7.  
  8. if (isset($_POST['submit'])) {
  9. $row = $_POST['rows'];
  10. $rowar = explode("\n", $row);
  11.  
  12.  
  13. $sql = "REPLACE INTO user (name) VALUES('" . implode("'),('", $rowar) . "')";
  14. $link->query($sql);
  15. }
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html lang="en">
  20. <head>
  21. <meta charset="UTF-8">
  22. <title>test</title>
  23. </head>
  24. <body>
  25. <form action="#" method="post">
  26. <textarea name="rows" id="rows" cols="30" rows="10"></textarea>
  27. <input type="submit" name="submit" value="submit">
  28. </form>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement