Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <style>
  2. .red {
  3. border: 1px solid red;
  4. }
  5. </style>
  6.  
  7. <?php
  8. ini_set("display_errors", 1);
  9. error_reporting(E_ALL);
  10. $name1 = "";
  11. $text1 = "";
  12. if (isset($_POST['name']) && isset($_POST['text'])) {
  13. $data = array_map("trim", $_POST);
  14. $data = array_map("strip_tags", $_POST);
  15. $name = $data['name'];
  16. $name1 = "Имя: ".$name;
  17. $text = $data['text'];
  18. $text1 = "Сообщение: ".$text;
  19. $submit = $data['submit'];
  20. $check = $data['check'];
  21. }
  22. if(empty($check)) { ?>
  23. <form action="" method="POST">
  24. <span>Ваше имя:</span>
  25. <input type="text" name="name" value="<?php echo (isset($name))?$name:"" ?>" class="<?php echo (isset($submit) && empty($name))?"red":"" ?>">
  26. <span>Ваше сообщение:</span>
  27. <textarea rows="1" cols="25" name="text" class="<?php echo (isset($submit) && empty($text))?"red":"" ?>"><?php echo (isset($text))?$text:"" ?></textarea>
  28. <input type="hidden" name="check">
  29. <input type="checkbox" name="check" <?php echo (empty($check))?"":"checked"; ?>>
  30. <input type="submit" name="submit">
  31. </form>
  32. <?php
  33. }
  34. echo $name1."<br>";
  35. echo $text1."<br>";
  36. ?>
Add Comment
Please, Sign In to add comment