form.blade.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. @extends('layout.app')
  2. @section('title', 'Отправка данных')
  3. @section('content')
  4. <h1>Отправка данных</h1>
  5. @if (session('success'))
  6. <div class="alert-success">
  7. {{ session('success') }}
  8. </div>
  9. @endif
  10. @if ($errors->any())
  11. <div class="error-list">
  12. <strong>Обнаружены ошибки:</strong>
  13. <ul>
  14. @foreach ($errors->all() as $error)
  15. <li>{{ $error }}</li>
  16. @endforeach
  17. </ul>
  18. </div>
  19. @endif
  20. <form method="POST" action="{{ route('form.submit') }}">
  21. @csrf {{-- Токен CSRF защиты --}}
  22. <div style="margin-bottom: 15px;">
  23. <label for="name" style="display: block; margin-bottom: 5px;">Имя:</label>
  24. <input type="text" id="name" name="name" value="{{ old('name') }}" required
  25. style="width: 100%; padding: 8px; box-sizing: border-box; border: 1px solid {{ $errors->has('name') ? 'red' : '#ccc' }};">
  26. @error('name')
  27. <small style="color: red;">{{ $message }}</small>
  28. @enderror
  29. </div>
  30. <div style="margin-bottom: 15px;">
  31. <label for="email" style="display: block; margin-bottom: 5px;">Email:</label>
  32. <input type="email" id="email" name="email" value="{{ old('email') }}" required
  33. style="width: 100%; padding: 8px; box-sizing: border-box; border: 1px solid {{ $errors->has('email') ? 'red' : '#ccc' }};">
  34. @error('email')
  35. <small style="color: red;">{{ $message }}</small>
  36. @enderror
  37. </div>
  38. <div style="margin-bottom: 15px;">
  39. <label for="message" style="display: block; margin-bottom: 5px;">Сообщение:</label>
  40. <textarea id="message" name="message" rows="5"
  41. style="width: 100%; padding: 8px; box-sizing: border-box; border: 1px solid {{ $errors->has('message') ? 'red' : '#ccc' }};">{{ old('message') }}</textarea>
  42. @error('message')
  43. <small style="color: red;">{{ $message }}</small>
  44. @enderror
  45. </div>
  46. <button type="submit" style="padding: 10px 15px; background-color: #3490dc; color: white; border: none; border-radius: 4px; cursor: pointer;">
  47. Отправить данные
  48. </button>
  49. </form>
  50. @endsection