我在Laravel 5中遇到了很多次问题。因此,我已经使用我可以在互联网上找到的所有解决方案调试我的代码。请看我的代码。
查看文件:
@section('content')
<form method="post" action="/yurt/save_reservation_data" enctype="multipart/form-data">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>" />
<table align="center">
<tr>
<td colspan="3"><b>Credit Card Details</b></td>
</tr>
<tr>
<td colspan="3">
Credit Card #<br />
<input type="text" id="ccNumber" name="ccNumber" class="required field" required="required" style="float:left;" value="">
<img src="{{ URL::asset('img/creditcards.png') }}" alt="" width="100" />
</td>
</tr>
<tr>
<td colspan="3">
Expiration<br />
Month <select name="exp_m" id="exp_m" style="width:80px;" class="required field">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
Year <select name="exp_y" id="exp_y" style="width:120px;" class="required field">
<option value="17">2017</option>
<option value="18">2018</option>
<option value="19">2019</option>
<option value="20">2020</option>
<option value="21">2021</option>
<option value="22">2022</option>
<option value="23">2023</option>
<option value="24">2024</option>
<option value="25">2025</option>
<option value="26">2026</option>
<option value="27">2027</option>
<option value="28">2028</option>
<option value="29">2029</option>
<option value="30">2030</option>
</select>
</td>
</tr>
<tr>
<td colspan="3">
CVV # <br />
<input type="text" id="ccCVV" name="ccCVV" size="10" required="required" class="required field" value="">
</td>
</tr>
<tr>
<td colspan="3">
<input type="checkbox" name="readTnC" value="1" >
I have read and agree to the <a onclick="popopen();" href="javascript:void(0);">Terms & Conditions</a> and <a onclick="popopen2();" href="javascript:void(0);">Privacy Policy</a> of Hinsdale Haute Route<br /><br />
</td>
</tr>
<tr>
<td colspan="3">
<input type="submit" class="btnRegisterGuestConfirm" value="Checkout" id="btnSubmit" name="checkout_submit" />
<input type="hidden" name="firstname" value="{{$firstname}}" />
<input type="hidden" name="lastname" value="{{$lastname}}" />
<input type="hidden" name="adults" value="{{$adults}}" />
<input type="hidden" name="children" value="{{$children}}" />
<input type="hidden" name="property_id" value="{{$property_id}}" />
<input type="hidden" name="address1" value="{{$address1}}" />
<input type="hidden" name="address2" value="{{$address2}}" />
<input type="hidden" name="city" value="{{$city}}" />
<input type="hidden" name="state" value="{{$state}}" />
<input type="hidden" name="zip" value="{{$zip}}" />
<input type="hidden" name="phone" value="{{$phone}}" />
<input type="hidden" name="cell" value="{{$cell}}" />
<input type="hidden" name="email" value="{{$email}}" />
<input type="hidden" name="sub_total_amount" value="{{$subtotaltext1}}" />
<input type="hidden" name="lodging_amount" value="{{$lodging_amount}}" />
<input type="hidden" name="date_start" value="{{$date_start}}" />
<input type="hidden" name="date_end" value="{{$date_end}}" />
<input type="hidden" name="total_amount" value="{{$totalamount}}" />
<input type="hidden" name="sherpa_service" value="{{$sherpa_serv}}" />
<input type="hidden" name="status" value="B" />
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
@stop
路线:
Route::post('save_reservation_data','FrontController@SubmitData');
控制器:
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use DB;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;
use Oureastudios\Laravel\BraintreeServiceProvider;
class FrontController extends Controller {
public function SubmitData(Request $request)
{
// code where I am getting requestes from from
$firstname = $request->input('firstname');
$lastname = $request->input('lastname');
}
}
当我点击表单中的提交按钮时,我收到此错误。我知道你们多次看过这个问题但是我已经应用了所有解决方案而且无法解决这个问题。
任何帮助将不胜感激。
答案 0 :(得分:0)
表单操作应为:
action="/save_reservation_data"
答案 1 :(得分:0)
路线不匹配
路线
Route::post('save_reservation_data','FrontController@SubmitData');
^^^^^^^^^^^^^^^^^^^^^^^
表单操作
action="/save_reservation_data"