Laravel Input/Output

Create Form
In Laravel there are two way to retrieve input value.

By Input method
By Request instance properties

Now we create form and display these value. For this purpose we create

1- User Input Form and save in View folder
for example - resources->view->userform.blade.php

2- Create Controller and save in Controller folder
for example - app->Http->Controllers->Usercontroller.php

3- Create routes and save in routes->web.php

Create Route


User input form

<title>User Input Form</title>
<form name="frm" action="printform" method="post">
<input type = "hidden" name = "_token" value = "<?php echo csrf_token() ?>">
<td><input type = "text" name = "name" /></td>
<td><input type = "text" name = "email" /></td>
<td colspan = "2" align = "center">
<input type = "submit" value = "Submit" />


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class InsertValue extends Controller {
public function inputform(){
return view('user_form');

public function printform(Request $request){

//By Input Method
echo $request->input('name');
echo "<br>";
echo $request->input('email');
// By Properties
echo "<br>";
echo $request->name;
echo "<br>";
echo $request->email;