I m new to Laravel and I am trying to pass values from a controller which I have received from a <form>
to a view and display the same in text boxes. Although, I have figured out how to do the same using method chaining but I would like to pass the values using an array and show the same into the textboxes in the view.
What I expect to do?
In the controller
, instead of method chaining:
return view('showvalues')->with(['name'=>$name, 'address'=>$address]);
Code so far,
controller
public function showvalues(Request $request)
{
$name=$request->get('name');
$address=$request->get('address');
$pass=$request->get('password');
$arr=array("$name","$address","$pass");
return view('showvalues')->with('name',$name)->with('address',$address);
}
Show values in showvalues
view:
<html>
<head>
</head>
<body>
<h1>
Show Value Page.
</h1>
<input type="text" name="n1" value="<?php echo $name;?>" /><br>
<input type="text" name="n3" value="<?php echo $address;?>" />
</body>
</html>