Laravel View Error - laravel

public function index()
{
$students = Student::all()->toArray();
return view('student.index', compact('students'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('student.create');//
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required',
'mothers_first_name' => 'required',
'mothers_last_name' => 'required',
'mothers_age' => 'required',
'fathers_first_name' => 'required',
'fathers_last_name' => 'required',
'fathers_age' => 'required'
]);
$student = new Student([
'first_name' => $request->get('first_name'),
'last_name' => $request->get('last_name'),
'Age' => $request->get('Age'),
'Address' => $request->get('Address'),
'Grade_Level' => $request->get('Grade_Level'),
'mothers_first_name' => $request->get('mothers_first_name'),
'mothers_last_name' => $request->get('mothers_last_name'),
'mothers_age' => $request->get('mothers_age'),
'fathers_first_name' => $request->get('fathers_first_name'),
'fathers_last_name' => $request->get('fathers_last_name'),
'fathers_age' => $request->get('fathers_age')
]);
$student->save();
return redirect()->route('student.index')->with('success', 'New teacher data successfully added');
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
$student = Student::find($id);
return view('student.edit', compact('student', 'id'));
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required'
]);
$student = Student::find($id);
$student->first_name = $request->get('first_name');
$student->last_name = $request->get('last_name');
$student->Age = $request->get('Age');
$student->Address = $request->get('Address');
$student->Grade_Level = $request->get('Grade_Level');
$student->save();
return redirect()->route('student.index')->with('success', 'Student data successfully updated');
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$student = Student::find($id);
$student->delete();
return redirect()->route('student.index')->with('success', 'Data successfully deleted');
}
This is my Controller
<div class="container student-create">
<div class="students-info">
<h3>Student's Personal Info</h3>
<form method="post" action="{{url('student')}}">
{{csrf_field()}}
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">First Name</label>
<input type="text" class="form-control" name="first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Last Name</label>
<input type="text" class="form-control" name="last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Age</label>
<input type="number" class="form-control" name="Age" placeholder="Enter Last Name">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="InputAddress">Address</label>
<input type="text" class="form-control" name="Address" placeholder="Enter Address">
</div>
<div class="col-sm">
<label for="InputAddress">Grade Level/College Level</label>
<select class="custom-select" name="Grade_Level">
<option selected="">Select Grade Level</option>
<option>Day Care 1</option>
<option>Day Care 2</option>
<option>Kinder Garten 1</option>
<option>Kinder Garten 2</option>
<option>Elementary 1</option>
<option>Elementary 2</option>
<option>Elementary 3</option>
<option>Elementary 4</option>
<option>Elementary 5</option>
<option>Elementary 6</option>
<option>Junior Highschool 1</option>
<option>Junior Highschool 2</option>
<option>Junior Highschool 3</option>
<option>Junior Highschool 4</option>
<option>Senior Highschool 1</option>
<option>Senior Highschool 2</option>
<option>College Level Information Technology 1</option>
<option>College Level Information Technology 2</option>
<option>College Level Information Technology 3</option>
<option>College Level Information Technology 4</option>
</select>
</div>
</div>
<h3>Student's Parents Info</h3>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Mothers First Name</label>
<input type="text" class="form-control" name="mothers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Last Name</label>
<input type="text" class="form-control" name="mothers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Age</label>
<input type="number" class="form-control" name="mothers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Fathers First Name</label>
<input type="text" class="form-control" name="fathers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Last Name</label>
<input type="text" class="form-control" name="fathers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Age</label>
<input type="number" class="form-control" name="fathers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group submit">
<button type="button submit" class="btn btn-success">
<i class="fas fa-check"></i> Submit Data
</button>
</div>
</form>
</div>
This is my html code
so the function is like , if i create a data then after that it should redirected to an index or a view page but in my case after submitting/creating data it gives me this error i dont know why
View Page
i have the same page with the same function as this one but it turns out to be okay thats why im wondering why and also this create page that i posted here i started to get this error after i change the style of it and i added some fillable area's like the mother's age, name and etc

I think you can try this.
Change the APP_DEBUG=false to APP_DEBUG=true in .env file and run the following command
php artisan config:clear
It will show the proper error on page
If not work proper, let me know

Related

The data that except in the store function does not go to the db

i'm learning laravel.
I have to do a simple store function to create a new post. The form appears to work correctly but the data does not reach the DB.
There's my store function:
public function store(Request $request)
{
$request->validate($this->validationRules);
$formData = $request->all();
$puzzle = new Puzzle();
$puzzle->fill($formData);
$puzzle->save();
// $newPuzzle = Puzzle::create($formData);
// return redirect()->route('puzzles.show', $newPuzzle->id);
}
My model:
class Puzzle extends Model
{
public $timestamps = false;
protected $fillable = [
'title',
'pieces',
'image',
'description',
'brand',
'price',
'available',
'quantity',
];
}
My form:
<form method="POST" action="{{route('puzzles.store')}}">
#csrf
<div class="mb-3">
<label for="title" class="form-label">Title</label>
<input type="text" class="form-control" id="title" name="title" value="{{ old('title') }}">
</div>
<div class="mb-3">
<label for="pieces" class="form-label">Pieces</label>
<input type="number" class="form-control" id="pieces" name="pieces" value="{{ old('pieces')}}">
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<input type="text" class="form-control" id="description" name="description" value="{{ old('description')}}">
</div>
<div class="mb-3 form-check">
<label class="form-check-label" for="available">Available</label>
<input type="checkbox" class="form-check-input" id="available" name="available" checked>
</div>
<div class="col-md-4">
<label for="quantity" class="form-label">Quantity</label>
<input type="number" min="1" step="any" class="form-control" id="quantity" name="quantity">
</div>
<div class="col-md-4">
<label for="price" class="form-label">Price</label>
<input type="number" min="3.0" step="0.1" class="form-control" id="price" name="price">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
what am I doing wrong?
Thank you
Make changes in your store function as per below
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'min:5|max:250',
'pieces' => 'numeric',
'description' => 'min:5|max:500',
'price' => 'numeric',
'available' => 'boolean',
'quantity' => 'numeric',
]);
$puzzle = Puzzle::create($request->only(
'title', 'pieces', 'description', 'available', 'quantity', 'price'
));
return redirect()->route('puzzles.show', $puzzle->id);
}
in .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_databse_name
DB_USERNAME=your_databse_user_name
DB_PASSWORD=your_databse_password

laravel The PUT method is not supported for this route. Supported methods: GET, HEAD

I have a problem. i want to create an annnouncements from my post table
by making 2 combined forms but i don't if this works cause I'm new to the laravel and this is what i have
the blade
<form action="{{route('superadminpage.admin_announce.admin_view_announce',$announces->id)}}" method="POST" enctype="multipart/form-data">
<div class="container">
<div class="jumnbotron">
<h1> </h1>
<br>
<div class="container">
<div class="jumnbotron">
<h1> Notification Announcement </h1>
<br>
<form method="POST" action="{{action('AdminController#store',$announces->id)}}">
{{csrf_field() }}
<div class="card">
<div class="card-body">
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{$announces->departments->department}} "> <h3> </h3>
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{ $announces->Title}}"> <br>
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{ $announces->Content}}"> <br>
</div>
<input type="submit" name="submit" class="btn btn-primary" value="notify"/>
</div>
</form>
edit
</div>
</div>
</form>
the Controller
public function view($id)
{
$announces = Post::find($id);
return view('superadminpage.admin_announce.admin_view_announce',compact('announces', 'id'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = request()->validate([
'department_id' => ['required', 'string', 'max:255'],
'Title' => ['required', 'string', 'max:255'],
'Content' => ['required', 'string', 'max:255'],
]);
$data = Announcement::create([
'department_id' => $data['department_id'],
'Title' => $data['Title'],
'Content' => $data['Content'],
]);
return redirect('admin_update')->with('success', 'Events has been added');
}
and the Route
Route::get('/admin_update', 'AdminController#index');
Route::get('/admin_view_announce/{id}', 'AdminController#view')->name('superadminpage.admin_announce.admin_view_announce');
Route::put('/admin_view_announce', 'AdminController#store');
Route::get('/admin_announce_create/{id}', 'AdminController#show');
Route::get('/admin_announce_editform/{id}', 'AdminController#edit')->name('superadminpage.admin_announce.admin_announce_editform');
Route::put('/admin_announce_editform/{id}', 'AdminController#update')->name('superadminpage.admin_announce.admin_announce_editform');
NOTE:(I'm not using an eloquent here i just fetch the data from the Post to the Announcement that showed in the blade)

How to insert a row in Laravel given that one field does not have a default value?

I try to insert the session user id in form but it was show me error this:
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into stocks (product_name, product_code, details, price, cost, quntity, updated_at, created_at) values (basmati Rice, 23432, dskljsdlkks;lk; ;ks;lvk, 40, 75, 100kg, 2019-09-09 08:43:12, 2019-09-09 08:43:12))
I think error on this line of code which I used for store the session id
<input type="hidden" name="user_id"
value="{{ $request->session()->put('user',$request->input('id')) }}"
> class="form-control">
This is my create blade page, which I make a form and try to insert the form fields.
#extends('layouts.app')
#section('content')
<div class="row">
<div class="col-md-12">
#if(count($errors) > 0)
<div class="alert alert-danger">
<ul>
#foreach($errors->all() as $error)
<li>{{$error}}</li>
#endforeach
</ul>
</div>
#endif
#if(\Session::has('success'))
<div class="alert alert-success">
<p>{{ \Session::get('success') }}</p>
</div>
#endif
<div class="card">
<div class="card-header">
<h5 class="title">Add New Product on Stock</h5>
</div>
<div class="card-body">
<form method="post" action="{{url('stock')}}">
{{csrf_field()}}
<div class="row">
<div class="col-md-6 pr-1">
<div class="form-group">
<label>Product Name</label>
<input type="text" name="user_id"
value="{{Auth::user()->id }}" class="form-control">
<input type="text" name="product_name" class="form-control" placeholder="Enter Product Name" />
</div>
</div>
<div class="col-md-6 pl-1">
<div class="form-group">
<label>Product Code</label>
<input type="text" name="product_code" class="form-control" placeholder="Enter product_code" />
</div>
</div>
</div>
</br>
<div class="row">
<div class="col-md-4 pr-1">
<div class="form-group">
<label>Price</label>
<input type="text" name="price" class="form-control" placeholder="Enter price" />
</div>
</div>
<div class="col-md-4 px-1">
<div class="form-group">
<label>Cost</label>
<input type="text" name="cost" class="form-control" placeholder="Enter cost" />
</div>
</div>
<div class="col-md-4 pl-1">
<div class="form-group">
<label>Quantity</label>
<input type="text" name="quntity" class="form-control" placeholder="Enter quntity" />
</div>
</div>
</div>
</br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Details</label>
<input type="text" name="details" class="form-control" placeholder="Enter details" />
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" />
</div>
</form>
</div>
</div>
#endsection
this is my controller file of stock
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Stock;
use Auth;
class StockController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$stocks = Stock::all()->toArray();
return view('stock.index', compact('stocks'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('stock.create');
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'user_id' =>'required',
'product_name' => 'required',
'product_code' => 'required',
'details' => 'required',
'price' => 'required',
'cost' => 'required',
'quntity' => 'required'
]);
$stock = new Stock([
'user_id' => Auth::user()->user_id,
'product_name' => $request->get('product_name'),
'product_code' => $request->get('product_code'),
'details' => $request->get('details'),
'price' => $request->get('price'),
'cost' => $request->get('cost'),
'quntity' => $request->get('quntity')
]);
$stock->save();
return redirect()->route('stock.index')->with('success', 'Data Added');
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
$stock = Stock::find($id);
return view('stock.edit', compact('stock', 'id'));
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, [
'product_name' => 'required',
'product_code' => 'required',
'details' => 'required',
'price' => 'required',
'cost' => 'required',
'quntity' => 'required'
]);
$stock = Stock::find($id);
$stock->product_name = $request->get('product_name');
$stock->product_code = $request->get('product_code');
$stock->details = $request->get('details');
$stock->price = $request->get('price');
$stock->cost = $request->get('cost');
$stock->quntity = $request->get('quntity');
$stock->save();
return redirect()->route('stock.index')->with('success', 'Data Updated');
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$stock = Stock::find($id);
$stock->delete();
return redirect()->route('stock.index')->with('success', 'Data Deleted');
}
}
You don't have to use the $request->input('id') to get the user id .
Simply use
Session::flash(Auth::user()->id);
For your code ,
<input type="hidden" name="user_id"
value="{{Auth::user()->id, Session::flash(auth::user()->id) }}"
> class="form-control">
And in your controller ,
when you are trying to save the user_id variable ,
EDIT ::::
$stock = new Stock([
'user_id' => Auth::user()->id,
'product_name' => $request->get('product_name'),
'product_code' => $request->get('product_code'),
'details' => $request->get('details'),
'price' => $request->get('price'),
'cost' => $request->get('cost'),
'quntity' => $request->get('quntity')
]);
Use the session variable to store ,.
Or you can directly store the user_id using Auth::user()->id in that line ,
'user_id' => Auth::user()->user_id,
change this:
$request->session()->put('user',$request->input('id'))
to like this:
Session::set('user',$request->input('id'));
Make attention, you need pass the $request to your view, so you can use the request data. Otherwise create a variable $user_id and pass it to your view blade. in this case you can do:
Session::set('user',$user_id);

Failed to save value select option

what's wrong in my project.
I want to save with select option, but the filed doesn't save data select option. it just save input text.
the project is taken different table, and the form just get the project_name and project_id. project_id will save in in table spent_times.
and the select option will save task_category in table spent_times
this my model
protected $table = 'spent_times';
protected $fillable = [
'task_category',
'story/meeting_name',
'assign',
'estimated_time',
'user_story',
'spent_time',
'percentage',
'lateness',
'index',
'project_id'
];
public function users() {
return $this->hasMany(User::class);
}
public function project() {
return $this->belongsTo(Project::class);
}
my create.blade.php
<form action="{{route('store')}}" method="POST">
#csrf
<div class="box-body">
<div class="form-group">
<label for="">Project *</label>
<select class="form-control select2" style="width: 100%;">
<option>Select One</option>
#foreach($projects as $id => $project)
<option value="{{$id}}">{{$project}}</option>
#endforeach
</select>
</div>
<div class="form-group">
<label for="">Story # Meeting Name *</label>
<input type="text" class="form-control" name="user_story">
</div>
<div class="form-group">
<label for="">Category *</label>
<select class="form-control select2" style="width: 100%;">
<option>Select One</option>
#foreach($task_categories as $category)
<option value="{{$category}}">{{$category}}</option>
#endforeach
</select>
</div>
<div class="form-group">
<label for="">Estimated *</label>
<input type="text" class="form-control" name="estimated_time">
</div>
</div>
<div class="box-footer">
<a href="{{route('index')}}">
<button type="submit" class="btn btn-primary col-md-12" style="border-radius : 0px;">SAVE</button>
</a>
</div>
</form>
my controller
public function create()
{
$spentimes = new SpentTime;
$project = new Project;
$projects = Project::select('project_name', 'id')->get();
return view('Ongoings.index', compact ('projects', 'task_categories', 'spentimes', 'project'));
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
dd($request->all());
$spentime = SpentTime::create([
'project_name' => request('project_name'),
'user_stroy' => request ('user_story'),
'task_category' => request('task_category'),
'estimated_time' => request('estimated_time')
]);
$spentime->save();
return redirect()->route('index');
}
error like this
error in web browser
please help me
You are expecting those fields from request in controller.
project_id
meeting_name
task_category
estimated_time
But You are just sending estimated_time,
other 3 fields are not present in you create.blade.php
In create.blade.php, category select input don't have any name.
that's why task_category is getting null from request('task_category'). But task_category field is not nullable in your database table.
Send form input properly as you are expecting in your controller. You can use dd($request->all()) to check.
I believe this is your task_category select box.
so this select box doesn't have a name attribute. that's the error.
Possible solution.
<div class="form-group">
<label for="">Category *</label>
<select name="task_category" class="form-control select2" style="width: 100%;">
<option>Select One</option>
#foreach($task_categories as $category)
<option value="{{$category}}">{{$category}}</option>
#endforeach
</select>
</div>

SQLSTATE[HY000]: General error: 1364 Field

public function index()
{
$students = Student::all()->toArray();
return view('student.index', compact('students'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('student.create');//
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required',
'mothers_first_name' => 'required',
'mothers_last_name' => 'required',
'mothers_age' => 'required',
'fathers_first_name' => 'required',
'fathers_last_name' => 'required',
'fathers_age' => 'required'
]);
$student = new Student([
'first_name' => $request->get('first_name'),
'last_name' => $request->get('last_name'),
'Age' => $request->get('Age'),
'Address' => $request->get('Address'),
'Grade_Level' => $request->get('Grade_Level'),
'mothers_first_name' => $request->get('mothers_first_name'),
'mothers_last_name' => $request->get('mothers_last_name'),
'mothers_age' => $request->get('mothers_age'),
'fathers_first_name' => $request->get('fathers_first_name'),
'fathers_last_name' => $request->get('fathers_last_name'),
'fathers_age' => $request->get('fathers_age')
]);
$student->save();
return redirect()->route('student.index')->with('success', 'New teacher data successfully added');
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
$student = Student::find($id);
return view('student.edit', compact('student', 'id'));
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required'
]);
$student = Student::find($id);
$student->first_name = $request->get('first_name');
$student->last_name = $request->get('last_name');
$student->Age = $request->get('Age');
$student->Address = $request->get('Address');
$student->Grade_Level = $request->get('Grade_Level');
$student->save();
return redirect()->route('student.index')->with('success', 'Student data successfully updated');
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$student = Student::find($id);
$student->delete();
return redirect()->route('student.index')->with('success', 'Data successfully deleted');
}
This is my Controller i dont know why im getting error, i have also other controller with the same function but it works fine. i just recently add this mothers name, age etc part but before it was just name,age address, etc and it works fine but after i add more fillable area's im getting this error
and this is the error im getting
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<ul>
#foreach($errors->all() as $error)
<li>{{$error}}</li>
#endforeach
</ul>
</div>
#endif
#if(\Session::has('success'))
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<p><strong>{{\Session::get('success')}}</strong></p>
</div>
#endif
<div class="carousel">
<div class="carousel-inner">
<img class="data-img" src="{{asset('img/adddata.png')}}">
</div>
</div>
<div class="container student-create">
<div class="students-info">
<h3>Student's Personal Info</h3>
<form method="post" action="{{url('student')}}">
{{csrf_field()}}
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">First Name</label>
<input type="text" class="form-control" name="first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Last Name</label>
<input type="text" class="form-control" name="last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Age</label>
<input type="number" class="form-control" name="Age" placeholder="Enter Last Name">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="InputAddress">Address</label>
<input type="text" class="form-control" name="Address" placeholder="Enter Address">
</div>
<div class="col-sm">
<label for="InputAddress">Grade Level/College Level</label>
<select class="custom-select" name="Grade_Level">
<option selected="">Select Grade Level</option>
<option>Day Care 1</option>
<option>Day Care 2</option>
<option>Kinder Garten 1</option>
<option>Kinder Garten 2</option>
<option>Elementary 1</option>
<option>Elementary 2</option>
<option>Elementary 3</option>
<option>Elementary 4</option>
<option>Elementary 5</option>
<option>Elementary 6</option>
<option>Junior Highschool 1</option>
<option>Junior Highschool 2</option>
<option>Junior Highschool 3</option>
<option>Junior Highschool 4</option>
<option>Senior Highschool 1</option>
<option>Senior Highschool 2</option>
<option>College Level Information Technology 1</option>
<option>College Level Information Technology 2</option>
<option>College Level Information Technology 3</option>
<option>College Level Information Technology 4</option>
</select>
</div>
</div>
<h3>Student's Parents Info</h3>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Mothers First Name</label>
<input type="text" class="form-control" name="mothers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Last Name</label>
<input type="text" class="form-control" name="mothers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Age</label>
<input type="number" class="form-control" name="mothers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Fathers First Name</label>
<input type="text" class="form-control" name="fathers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Last Name</label>
<input type="text" class="form-control" name="fathers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Age</label>
<input type="number" class="form-control" name="fathers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group submit">
<button type="button submit" class="btn btn-success">
<i class="fas fa-check"></i> Submit Data
</button>
</div>
</form>
</div>
Table Structure
Student Model
i hope you could help me and Thank in advance
You can change your fathers_age field name to fathers_Age. Because you taken fathers_Age field in your database.

Resources