无法从表单标签调用帖子URL。当我单击提交按钮时,它将转到另一个URL名称viewstudentmarks。
<form method="post" style="padding-top:30px;" action="{{ route('updatestudentmark',['id' => $stuid]) }}">
{{csrf_field()}}
<input type="hidden" name="type" value="{{$examtype}}">
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="row">
<div class="col-lg-12">
<div class="form-group">
</div>
</div>
</div>
</div>
</div>
@foreach($extra as $detail)
<a class="btn btn-success" href='{{ url("viewstudentmarks/{$detail->class_id}") }}'>Back</a>
@endforeach
<input type="submit" class="btn btn-primary">
</form>
和web.php
Route::post('updatestudentmark/{id}','MarksRecordController@update')->name('updatestudentmark');
Route::get('viewhealthdetails/{id}','HealthDetailsController@viewstudents')->name('viewhealthdetails');
答案 0 :(得分:1)
最好使用如下名称路由:
Route::post('updatestudentmark/{id}','MarksRecordController@update')->name('test.route');
在刀锋中以动作形式执行以下操作:
{{route('test.route',['id' => $stuid])}}
答案 1 :(得分:1)
在表单标签中添加#include <iostream>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <locale>
#include <algorithm>
using namespace std;
int main()
{
srand((unsigned)time(NULL));
int n, i, k = 0;
int sum;
int S = 0;
cout << "What size array would you like:" << endl;
cout << "n = ";
cin >> n;
int* A = new int[n];
sum = 0;
cout << "Input elements: ";
for (i = 0; i < n; i++) cin >> A[i];
for (int i = 0; i < n; i++)
{
cout << A[i] << " ";
}
cout << endl;
cout << endl;
for (int i = 0; i < n; i++)
{
if (A[i] % 2 == 0) {
k = k + 1;
sum += A[i];
}
}
cout << "Ampount of even numbs: " << k << endl << endl;
cout << "Sum of even numbs: " << sum << endl << endl;
cout << "New array: " << endl;
for (int i = 0; i < n; i++)
{
if (abs(A[i]) % 2 == 0)
{
for (int j = 0; j < i; j++)
{
S += A[j];
}
A[i] = S;
}
}
for (int i = 0; i < n; i++)
{
cout << A[i] << " ";
}
cout << endl;
cout << endl;
}
名称:
{{ route('') }}
此外,请检查您的控制器代码。在控制器中,是否调用过重定向方法。
谢谢