我正在尝试发出一个post请求,在create-box-form-blde.php中的第一步保存用户数据。
create-box-form-blade.php
@extends('layouts.home')
@section('content')
{{ csrf_field() }}
<form name='basics' action='/box?cnb=s3' method='post' enctype='multipart/form-data'>
<fieldset>
<input type='' required value='$price' name='price' min='$price' max='$price'>
<input type='text' required value='' placeholder='Youtube channel name' name='page_name'>
<input type='number' required value='' placeholder='Number of subscriptions you will initially accept' name='box_supply' min='1' max='1000000'>
</fieldset>
<fieldset>
<label>Do you need help with product curation?</label>
<label>Yes
<input type='radio' id='disable' value='1' checked name='curation'/>
</label><label>
No
<input type='radio' id='removeDisabled' value='0' name='curation'/>
</label>
</fieldset>
<fieldset>
<input class='optional' type='number' disabled required name='num_products' placeholder='Number of products in box' min='1' max='25'>
<input class='optional' type='number' disabled required value='' placeholder='Weight of box in pounds' name='box-weight' min='1' max='1000000'>
<input class='optional' type='number' disabled required value='' placeholder='Length of box in inches' name='box-length' min='1' max='1000000'>
<input class='optional' type='number' disabled required value='' placeholder='Width of box in inches' name='box-width' min='1' max='1000000'>
<input class='optional' type='number' disabled required value='' placeholder='Height of box in inches' name='box-height' min='1' max='1000000'>
</fieldset>
<input type='hidden' value='basics' />
</fieldset><fieldset>
<input type='submit' value='Save' />
</fieldset>
</form>
</div>
@endsectionin web.php
Route::post('/box?cnb=s3', 'App\Http\Controllers\BoxController@step2')->name('box.step2');但是,当我单击保存时,会在下面得到这个错误。
此路由不支持POST方法。支持的方法: GET,HEAD.
发布于 2021-12-09 15:42:11
您可以使用类似的post请求
路线:post(‘/box’,'App\Http\Controllers\BoxController@step2')->name('box.step2');)
在这个step2函数中,您可以调用传递该函数中的queryConditions。
就像->
public function step2(Request $request)
{
if (isset($requestQueryString['cnb'])) {
$queryConditions = ['cnb' => $requestQueryString['cnb']];
//and play with your conditions you need it..
}
}https://stackoverflow.com/questions/70291282
复制相似问题