Answer the question
In order to leave comments, you need to log in
How to display data from a form in another PHP/Laravel page?
Hello. There is a following task.
On the page, the user enters their data and submits the form. During the submission, a password is generated, which must be displayed on a new page. I can't display the password on the new page. In its place is just emptiness, no data and no errors.
As I see:
index.php
<form id="trialForm" method="post" name="trialForm" class="ui form">
<input type="email" id="emailCompany" name="emailCompany" placeholder="Email Address" data-validate="email-address" autocomplete="off" required="required">
<input type="text" id="nameCompany" name="nameCompany" placeholder="Company Name" data-validate="company-title" autocomplete="off" required="required">
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
<input type="hidden" name="_psw" value="{{{ str_random(8) }}}" /> <!--генерируем пароль-->
<button type="submit" class="ui huge green button">
Start Trial
</button>
</form>
Route::post( '/' ,function() { return Redirect::to('/success' , 301); });
Route::get( '/success' ,'Production\[email protected]' );
public function Success(request $request)
{
$psw = $request->get('_psw'); //получаем значение из отправленной формы
return view('pages.success.Success', compact("psw"));
}
<div class="ui two column grid">
<div class="column">
Your temporary password
<br />
<b id="copyTarget">{{ $psw }}</b>
</div>
<div class="column">
<div id="copyButton" class="ui button">Click to Copy</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
I can assume that the action parameter of the form is lost :)
<form id="trialForm" method="post" action="/" name="trialForm" class="ui form">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question