I have two (2) pages. One is a Create page and the other one is a Confirm page. Create page has a form and a "Proceed to Confirm" button which will redirect to Confirm page. Confirm page should display all the inputs from the Create page, then the user will be able to submit it right after once he/she has checked all the inputted values.
Controller:
public function create()
{
return ('pages.create');
}
public function confirmCreate()
{
$value = Input::all();
Session::flash('value', $value);
return view('pages.confirm-create')->with('value', $value);
}
Routes:
Route::get('create', 'MyController@create')->name('create');
Route::post('confirm-create', 'MyController@confirmCreate')->name('confirm-create');
Route::put('store', 'MyController@store')->name('store');
Create page View:
{{ Form::open(array('url' => 'confirm-create',
'method' => 'POST',
'class' => 'form-horizontal')) }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label class="col-md-4 control-label required">Name</label>
<div class="col-md-6">
<input id="name" placeholder="Name" type="text" class="form-control" name="name" value="{{ old('name) }}" required autofocus>
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('contactNumber') ? ' has-error' : '' }}">
<label class="col-md-4 control-label required">Contact Number</label>
<div class="col-md-6">
<input id="contactNumber" placeholder="Contact Number" type="text" class="form-control" name="contactNumber" value="{{ old('contactNumber) }}" required autofocus>
@if ($errors->has('contactNumber'))
<span class="help-block">
<strong>{{ $errors->first('contactNumber') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-6">
<button type="submit" class="btn btn-primary">
Proceed to Confirm
</button>
</div>
</div>
{{ Form::close() }}
Confirm page View:
{{ Form::open(array('url' => 'pages',
'method' => 'POST',
'class' => 'form-horizontal')) }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label class="col-md-4 control-label required">Name</label>
<div class="col-md-6">
<label class="control-label">{{ old('name') }}</label>
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('contactNumber') ? ' has-error' : '' }}">
<label class="col-md-4 control-label required">Contact Number</label>
<div class="col-md-6">
<label class="control-label">{{ old('contactNumber') }}</label>
@if ($errors->has('contactNumber'))
<span class="help-block">
<strong>{{ $errors->first('contactNumber') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-6">
<button type="submit" class="btn btn-primary">
Submit
</button>
</div>
</div>
{{ Form::close() }}
I can't seem to display the data from my Create page (after clicking "Proceed to Confirm" button) to my Confirm page. How should my controller, routes, and view (both Create and Confirm pages) look like? Send help. Thanks!