Home > Enterprise >  form making with using laravel
form making with using laravel

Time:12-09

I need to display this information on a different page by getting 4 different information from the user (for example: name, surname, phone number and email) and I need to do this with laravel

<form method="POST" action="/register">
  @csrf

  <label for="name">Name:</label>
  <input type="text" id="name" name="name"><br><br>

  <label for="surname">Surname:</label>
  <input type="text" id="surname" name="surname"><br><br>

  <label for="phone">Phone Number:</label>
  <input type="text" id="phone" name="phone"><br><br>

  <label for="email">E-mail:</label>
  <input type="email" id="email" name="email"><br><br>

  <button type="submit">Sign Up</button>
</form>

I wrote a code like this but I couldn't continue

CodePudding user response:

<form action="{{route('register')}}" method="post" enctype="multipart/form-data">
                @csrf

  <label for="name">Name:</label>
  <input type="text" id="name" name="name"><br><br>

  <label for="surname">Surname:</label>
  <input type="text" id="surname" name="surname"><br><br>

  <label for="phone">Phone Number:</label>
  <input type="text" id="phone" name="phone"><br><br>

  <label for="email">E-mail:</label>
  <input type="email" id="email" name="email"><br><br>

   <input   type="submit"  name="submit">


so you should use enctype="multipart/form-data" to send multi request to your route and use {{route('register')}} and at the end you must defined in web.php

Route::post('register', [RegisteredUserController::class, 'store']);

CodePudding user response:

you can get logged-in user information in your blade files like below for example if you want to get the user name

{{ auth()->user()->name }} 

or if you want to take user id

{{ auth()->user()->id}} 
  • Related