Laravel blade not showing CSS on specific page - php

Laravel 6.0 not show one specific page's css. Others page works smoothly.
This is my code
"satisekle.blade.php and edit.blade.php almost same page. only difference is some variable. php code is working but css is not loaded. My assets folder in public/assets
<link rel="shortcut icon" href="assets/dist/img/ico/favicon.png" type="image/x-icon">
<!-- jquery-ui css -->
<link href="assets/plugins/jquery-ui-1.12.1/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<!-- Bootstrap -->
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<!-- Bootstrap rtl -->
<!--<link href="assets/bootstrap-rtl/bootstrap-rtl.min.css" rel="stylesheet" type="text/css"/>-->
<!-- Lobipanel css -->
<link href="assets/plugins/lobipanel/lobipanel.min.css" rel="stylesheet" type="text/css"/>
<!-- Pace css -->
<link href="assets/plugins/pace/flash.css" rel="stylesheet" type="text/css"/>
<!-- Font Awesome -->
<link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<!-- Pe-icon -->
<link href="assets/pe-icon-7-stroke/css/pe-icon-7-stroke.css" rel="stylesheet" type="text/css"/>
<!-- Themify icons -->
<link href="assets/themify-icons/themify-icons.css" rel="stylesheet" type="text/css"/>
<head>
#include('partials._head')
</head>
<body class="hold-transition sidebar-mini">
#include('partials.topbar')
<div class="container" id="contentall">
<div class="content">
#include('partials.leftbar')
#yield('content')
</div>
</div>
</body>
#include('partials.javascript')
Blade
#extends('main')
#section('content')
<form action="{{ route('satislar.store') }}" method="post">
{{ csrf_field() }}
<div class="form-group">
<label for="exampleInputEmail1">Satış Takip Numarası</label>
<input type="text" class="form-control" readonly value="{{$random}}" name="satis_takip_no">
<small id="emailHelp" class="form-text text-muted">Random Atanan Unique Takip Numarası</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Ürün</label>
<input type="text" class="form-control" required id="exampleInputEmail1" aria-describedby="emailHelp"
name="urun" placeholder="Ürün">*
<small id="emailHelp" class="form-text text-muted">Ürün İsmini Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Birim</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="birim"
placeholder="Birim">
<small id="emailHelp" class="form-text text-muted">Ürün Miktarını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Firma Adı</label>
<input type="text" class="form-control" required id="exampleInputEmail1" aria-describedby="emailHelp"
name="firma" placeholder="Firma Adı">*
<small id="emailHelp" class="form-text text-muted">Firmanın Adını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Yetkili</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="yetkili"
placeholder="Yetkili">
<small id="emailHelp" class="form-text text-muted">Teslim Alacak Yetkilinin İsmini Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Telefon</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="telefon"
placeholder="Telefon">
<small id="emailHelp" class="form-text text-muted">Ulaşılacak Kişinin Telefon Numarasını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">E-Posta</label>
<input type="email" class="form-control" id="exampleInputEmail1" required aria-describedby="emailHelp"
name="eposta" placeholder="E-Posta">*
<small id="emailHelp" class="form-text text-muted">Satışı Takip edecek Kişinin E-postasını Giriniz</small>
</div>
<button type="submit" class="btn btn-primary">Gönder</button>
</form>
#endsection
Controller
public function satisekle()
{
$number = mt_rand(1000000000, mt_getrandmax());
if ($this->sorgula($number) === "") {
return $this->satisekle();
}
return view('satislar.satisekle')->with('random', $number);
}
public function edit($id)
{
$satis = Satislar::find($id);
return view('satislar.edit')->with('satis', $satis);
}
and route;
Route::get('/satisekle', 'satislarController#satisekle');
Route::get('/index', 'satislarController#index');
Route::get('/satislar/{$id}/edit', 'satislarController#edit');
Route::resource('satislar', 'satislarController');
and this is not working. not show css i'm completely crazy;
#extends('main')
#section('content')
<form action="{{ route('satislar.update',$satis->id)}}" method="post">
#method('PUT')
{{ csrf_field() }}
<div class="form-group">
<label for="exampleInputEmail1">Satış Takip Numarası</label>
<input type="text" class="form-control" value="{{$satis->takip_no}}" name="satis_takip_no" readonly>
<small id="emailHelp" class="form-text text-muted">Random Atanan Unique Takip Numarası</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Ürün</label>
<input type="text" class="form-control" required id="exampleInputEmail1" value="{{$satis->urun}}" aria-describedby="emailHelp" name="urun" placeholder="Ürün">*
<small id="emailHelp" class="form-text text-muted">Ürün İsmini Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Birim</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" value="{{$satis->birim}}" name="birim" placeholder="Birim">
<small id="emailHelp" class="form-text text-muted">Ürün Miktarını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Firma Adı</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" value="{{$satis->firma}}" name="firma" placeholder="Firma Adı" required>*
<small id="emailHelp" class="form-text text-muted">Firmanın Adını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Yetkili</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="yetkili" value="{{$satis->yetkili}}" placeholder="Yetkili">
<small id="emailHelp" class="form-text text-muted">Teslim Alacak Yetkilinin İsmini Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Telefon</label>
<input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="telefon" value="{{$satis->telefon}}" placeholder="Telefon">
<small id="emailHelp" class="form-text text-muted">Ulaşılacak Kişinin Telefon Numarasını Giriniz</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">E-Posta</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="eposta" value="{{$satis->eposta}}" placeholder="E-Posta" required>*
<small id="emailHelp" class="form-text text-muted">Satışı Takip edecek Kişinin E-postasını Giriniz</small>
</div>
<button type="submit" class="btn btn-primary">Gönder</button>
</form>
#endsection

IMHO it's better if you use the asset() helper to load your assets, e.g.:
<link rel="shortcut icon" href="{{ asset('dist/img/ico/favicon.png') }}" type="image/x-icon">
<!-- jquery-ui css -->
<link href="{{ asset('plugins/jquery-ui-1.12.1/jquery-ui.min.css') }}" rel="stylesheet" type="text/css"/>
<!-- Bootstrap -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css"/>
<!-- Bootstrap rtl -->
<!--<link href="{{ asset('bootstrap-rtl/bootstrap-rtl.min.css') }}" rel="stylesheet" type="text/css"/>-->
<!-- Lobipanel css -->
<link href="{{ asset('plugins/lobipanel/lobipanel.min.css') }}" rel="stylesheet" type="text/css"/>
<!-- Pace css -->
<link href="{{ asset('plugins/pace/flash.css" rel="stylesheet') }}" type="text/css"/>
<!-- Font Awesome -->
<link href="{{ asset('font-awesome/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css"/>
<!-- Pe-icon -->
<link href="{{ asset('pe-icon-7-stroke/css/pe-icon-7-stroke.css') }}" rel="stylesheet" type="text/css"/>
<!-- Themify icons -->
<link href="{{ asset('themify-icons/themify-icons.css') }}" rel="stylesheet" type="text/css"/>
You can read in this SO question on the various type of relative and absolute URLs for href= and which are better to use.

Related

multi page form laravel

Hello I am creating a multi form page but when data is insetting in database it insert on 2 row with different ids I need each submit be as one id not 2 ids kindly check the code below note that I am new should I add the session or what is the best way to do it .thank you
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class secmultiController extends Controller
{
public function NameMentionded(){
return view('multiform.name');
}
public function AddNameMentionded(Request $request){
$request->validate([
'empname'=> 'required ',
'empnum'=> 'required ',
]);
$query = DB::table('secmultis')->insert([
'empname'=>$request->input('empname'),
'empnum'=>$request->input('empnum'),
]);
return redirect('reports');
}
public function ReportPerson(){
return view('multiform.as');
}
public function adds(Request $request){
$request->validate([
'incnam'=> 'required ',
'incnum' => 'required ',
'inctdes' => 'required ',
'inctype' => 'required ',
'inncity' => 'required ',
'incday' => 'required ',
'incatt' => 'required ',
'incterm' => 'required ',
]);
$query = DB::table('secmultis')->insert([
'incnam'=>$request->input('incnam'),
'incnum'=>$request->input('incnum'),
'inctdes'=>$request->input('inctdes'),
'inctype'=>$request->input('inctype'),
'incterm'=>$request->input('incterm'),
'inncity'=>$request->input('inncity'),
'incday'=>$request->input('incday'),
'incatt'=>$request->input('incatt'),
]);
if($query){
return back()->with('success','Data have been successfully inserted');
}else{
return back()->with('fail','Data have not been successfully inserted');
}
}
}
Route
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\MultiformController;
use App\Http\Controllers\secmultiController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('test');
});
/// multipage form
Route::controller(secmultiController::class)->group(function(){
Route::get('/name','NameMentionded')->name('name.mentioned');
Route::post('/add','AddNameMentionded')->name('addname.mentioned');
Route::get('/reports','ReportPerson');
Route::POST('/adds','adds');
});
Route::get('/dashboard', function () {
return view('admin.index');
})->middleware(['auth','verified'])->name('dashboard');
require __DIR__.'/auth.php';
nano.blade
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Dashboard | Makassed Speak </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
<meta content="Themesdesign" name="author" />
<!-- App favicon -->
<link rel="shortcut icon" href="{{ asset('backend/assets/images/favicon.ico') }}">
<!-- jquery.vectormap css -->
<link href="{{ asset('backend/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css') }}" rel="stylesheet" type="text/css" />
<!-- DataTables -->
<link href="{{ asset('backend/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}" rel="stylesheet" type="text/css" />
<!-- Responsive datatable examples -->
<link href="{{ asset('backend/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css') }}" rel="stylesheet" type="text/css" />
<!-- Bootstrap Css -->
<link href="{{ asset('backend/assets/css/bootstrap.min.css') }}" id="bootstrap-style" rel="stylesheet" type="text/css" />
<!-- Icons Css -->
<link href="{{ asset('backend/assets/css/icons.min.css') }}" rel="stylesheet" type="text/css" />
<!-- App Css-->
<link href="{{ asset('backend/assets/css/app.min.css') }}" id="app-style" rel="stylesheet" type="text/css" />
<!-- App bootstrap-->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.css" >
<!-- App toastr-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css" >
<!-- App datepicker-->
<link href="{{asset('backend/assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css')}}" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row" style="margin-top:50px;";>
<br>
</div>
</div>
<form action="add" method="POST" novalidate="">
#csrf
<div class="container">
<div class="col-md-6 offset-md-3">
<div class="card">
<div class="card-header bg-secondary text-white">nona </div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Employee Name </label>
<input type="text" class="form-control" name="empname" placeholder="" required="">
<span style="color:red;">#error('empname') {{$message}} #enderror</span>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label"> Employee #</label>
<input type="text" class="form-control" name="empnum" placeholder="" required="">
<span style="color:red;">#error('empnum') {{$message}} #enderror</span>
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Next</button>
</div>
</form>
<script src="{{asset('backend/assets/libs/jquery/jquery.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/bootstrap/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/metismenu/metisMenu.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/simplebar/simplebar.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/node-waves/waves.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/parsleyjs/parsley.min.js')}}"></script>
<script src="{{asset('backend/assets/js/pages/form-validation.init.js')}}"></script>
<script src="{{asset('backend/assets/js/app.js')}}"></script>
<script src="{{asset('backend/assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js')}}"></script>
</body>
</html>
as.blade
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Dashboard | Makassed Speak </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
<meta content="Themesdesign" name="author" />
<!-- App favicon -->
<link rel="shortcut icon" href="{{ asset('backend/assets/images/favicon.ico') }}">
<!-- jquery.vectormap css -->
<link href="{{ asset('backend/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css') }}" rel="stylesheet" type="text/css" />
<!-- DataTables -->
<link href="{{ asset('backend/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}" rel="stylesheet" type="text/css" />
<!-- Responsive datatable examples -->
<link href="{{ asset('backend/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css') }}" rel="stylesheet" type="text/css" />
<!-- Bootstrap Css -->
<link href="{{ asset('backend/assets/css/bootstrap.min.css') }}" id="bootstrap-style" rel="stylesheet" type="text/css" />
<!-- Icons Css -->
<link href="{{ asset('backend/assets/css/icons.min.css') }}" rel="stylesheet" type="text/css" />
<!-- App Css-->
<link href="{{ asset('backend/assets/css/app.min.css') }}" id="app-style" rel="stylesheet" type="text/css" />
<!-- App bootstrap-->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.css" >
<!-- App toastr-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css" >
<!-- App datepicker-->
<link href="{{asset('backend/assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css')}}" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row" style="margin-top:50px;";>
<br>
</div>
</div>
s
<form action="adds" method="POST" novalidate="">
#csrf
<div class="container">
<div class="col-md-6 offset-md-3">
<div class="card">
<div class="card-header bg-secondary text-white">Emlpoyee </div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Employee Name </label>
<input type="text" class="form-control" name="incnam" placeholder="" required="">
<span style="color:red;">#error('incnam') {{$message}} #enderror</span>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label"> Employee #</label>
<input type="text" class="form-control" name="incnum" placeholder="" required="">
<span style="color:red;">#error('incnum') {{$message}} #enderror</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<label class="form-label">INCIDENT DETAILS</label>
<textarea class="form-control" name="inctdes" id="" cols="30" rows="10"></textarea>
<span style="color:red;">#error('inctdes') {{$message}} #enderror</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<label for="" class="form-label">INCIDENT TYPE</label>
<select class="form-select" name="inctype" id="" required="">
<option selected="" disabled="" value="">Choose...</option>
<option>THEFT</option>
<option>NON COMPLIANCE WITH COMPANY POLICY</option>
<option>ABUSING POWER</option>
<option>USING COMPANY PROPERTY FOR PERSONAL INTEREST</option>
<option>NEGLIGENCE</option>
</select>
<span style="color:red;">#error('inctype') {{$message}} #enderror</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<label for="" class="form-label">INCIDENT TYPE</label>
<select class="form-select" name="inncity" id="" required="">
<option selected="" disabled="" value="">Choose...</option>
<option>Beirut</option>
<option>North</option>
<option>South</option>
</select>
<span style="color:red;">#error('inncity') {{$message}} #enderror</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-4">
<label class="form-label">INCIDENT DATE
</label>
<div class="input-group" id="datepicker2">
<input type="text" name="incday" class="form-control" placeholder="dd M, yyyy" data-date-format="dd M, yyyy" data-date-container="#datepicker2" data-provide="datepicker" data-date-autoclose="true">
<span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
<span style="color:red;">#error('incday') {{$message}} #enderror</span>
</div><!-- input-group -->
</div>
</div>
<div class="col-md-6">
<div class="mb-6">
<label class="form-label">INCIDENT DATE
</label>
<div class="input-group">
<input type="file" class="form-control" name="incatt" id="customFile">
<span style="color:red;">#error('incatt') {{$message}} #enderror</span>
</div>
</div>
</div>
/div>
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<div class="d-flex flex-wrap gap-2">
<h6>I confirm that, all above provided information is correct.
</h6>
<input type="checkbox" name="incterm" id="switch3" switch="bool" checked="">
<label for="switch3" data-on-label="Yes" data-off-label="No"></label>
<span style="color:red;">#error('incterm') {{$message}} #enderror</span>
</div>
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Next</button>
</div>
</form>
<script src="{{asset('backend/assets/libs/jquery/jquery.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/bootstrap/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/metismenu/metisMenu.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/simplebar/simplebar.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/node-waves/waves.min.js')}}"></script>
<script src="{{asset('backend/assets/libs/parsleyjs/parsley.min.js')}}"></script>
<script src="{{asset('backend/assets/js/pages/form-validation.init.js')}}"></script>
<script src="{{asset('backend/assets/js/app.js')}}"></script>
<script src="{{asset('backend/assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js')}}"></script>
</body>
</html>

How do i provide inline error feedback with Laravel 5

I'm building a form using Laravel 5 and I want to error messages to appear next to the field of authentication page.
This is my controller
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootstrap-theme.css" rel="stylesheet">
<link href="/css/all.css" rel="stylesheet">
<link href="/css/all.min.css" rel="stylesheet">
<link href="/css/Style.css" rel="stylesheet">
<script src="/js/jquery-2.2.4.min.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/all.js"></script>
<script src="/js/all.min.js"></script>
<title>LOGIN</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
</head>
<body>
<form id="form1" action="/loginme" method="post">
<div >
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="login_form">
<div class="inputWithIcon">
<i class="fas fa-user-tie" ></i>
<input type="text" placeholder="Username" class="form-control" name="username" />
</div>
<div class="inputWithIcon">
<i class="fas fa-unlock-alt" ></i>
<input type="password" placeholder="Password" class="form-control" name="password" />
</div>
<br />
<label class="invalid-feedback" id="login_error"></label>
<input type="submit" id="submitBtn" class="btn btn-secondary btn-block login-submit-btn" value="Login"></input>
</div>
</div>
</form>
</body>
</html>
And I would like to display the alert message with a click on the button "submitBtn"
this is my controller
You need to use validation in your controller.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
use DB;
class LoginController extends Controller {
public function login(Request $request){
$this->validate($request, [
'username' => 'required',
'password' => 'required'
]);
$username = $request->input('username');
$password = $request->input('password');
$checklogin = DB::table('users')->where(['Username' => $username, 'Password' => $password])->get();
if(count($checklogin)){
echo "login successful";
}else{
return view('login');
}
}
}
Then in your blade you can use the retured error like this:
<input type="text" placeholder="Username" class="form-control" name="username" />
#if ($errors->has('username'))
<span class="error-text text-danger">{{ $errors->first('username') }}</span>
#endif
<input type="password" placeholder="Password" class="form-control" name="password" />
#if ($errors->has('password'))
<span class="error-text text-danger">{{ $errors->first('password') }}</span>
#endif
yo can write
<input type="text" placeholder="Username" class="form-control" name="username" />
#if ($errors->has('username')) <span class="error-text text-danger">{{ $errors->first('username') }}</span> #endif
<input type="password" placeholder="Password" class="form-control" name="password" />
#if ($errors->has('password')) <span class="error-text text-danger">{{ $errors->first('password') }}</span> #endif

Radio button is not showing in page

For laravel project i use a metarial design bootstrap(MDBootstrap) template. use this template for master design and if i need to add somthing then i use #yeild(''). every thing is fine but if want to add radio button in form, this button is not showing in page.
here is my head what master.blade.php used..
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<!-- Scripts -->
<!-- Fonts -->
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<link href="metarial/css/mdb.min.css" rel="stylesheet">
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="metarial/bootstrap.min.css" rel="stylesheet">
at last of the body...
<script type="text/javascript" src="metarial/js/jquery-3.2.1.min.js"></script>
<!-- Tooltips -->
<script type="text/javascript" src="metarial/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
{{--
<script type="text/javascript" src="metarial/js/bootstrap.min.js"></script> --}}
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="metarial/js/mdb.min.js"></script>
<script>
// SideNav Initialization
$(".button-collapse").sideNav();
new WOW().init();
</script>
Form is...
<form role="form" action="{{url('/children/add')}}" method="post" enctype="multipart/form-data">
#csrf
<div class="form-group ml-4 mr-4">
<div class="row">
<div class="col-6">
<label for="name">First Name</label>
<input value="{{ old('firstName') }}" name="firstName" type="text" class="form-control" id="first" placeholder="First Name">
</div>
<div class="col-6">
<label for="name">Last Name</label>
<input value="{{ old('lastName') }}" name="lastName" type="text" class="form-control" id="last" placeholder="Last Name">
</div>
</div>
</div>
<div class="radio form-group ml-4 mr-4">
<label><input type="radio" name="optradio">Male</label>
</div>
<div class="radio">
<label><input type="radio" name="optradio">Female</label>
</div>
<div class="form-group ml-4 mr-4">
<label for="Birthday">Birthday</label>
<input name="birthday" type="date" class="form-control" id="birthday">
</div>
<div class="form-group ml-4 mr-4">
<label for="image">Profile Image</label>
<input type="file" name="image" class="form-control" id="image">
</div>
<button type="submit" style="background-color:#2DAE60;" class="btn">
<i class="fa fa-plus"></i> ADD </button>
</form>
picture of this page where radio button missing but text 'Male','Female' is remaining...
can anyone help me please?
Try changing this:
<div class="radio">
<label><input type="radio" name="optradio">Female</label>
</div>
To this:
<div class="radio">
<input type="radio" id="female-rb" name="optradio" />
<label for="female-rb">Female</label>
</div>
When using labels you should define for which radio button the label applies. You do this by adding the for attribute and let it referring the id of the radio button. To correctly render the radio button you should place the input first and then the label.

HTML Form Not Working - HTML <form>

I am new to StackOverflow but am a great dev.
I was making a HTML Form for my 192.168.1.230 Local Server, but ran into this problem with my html code when I click the submit button (Near the bottom of the code) Pls Help If You Can. I don't think you will need my CSS but ask me if you do and I will reply with all CSS code.
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br><h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" action="../php/search.php" method="post">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
You need to add this action="../php/search.php" method="post" in your form tag
Do this:
<form class="form-horizontal" action="../php/search.php" method="post">
Then change your button for submission to:
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
In your php script, check for subumission like:
<?php
if(isset($_POST['singlebutton'])){//name of button
$password = $_POST['passwordinput']; //
$name = $_POST['textinput'];
$email = $_POST['email'];
//etc. Remember to access the name attribute as it will contain the value from your form
print_r($_POST);//returns associative array(key => value)
}
?>
I see you have a password field, Please do not store passwords in plain text, use php's password_hash
You have to pass action & method attribute on form tag instead of button
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal" action="../php/search.php" method="post">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br>
<h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
So The Working Code Thanks To You Two Is:
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal" action="../php/search.php" method="post">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br>
<h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
Thanks A Lot!

Form submitting but mysql query not properly functioning [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
The following code gives a signup form that i created but unfortunately though it works the mysql query fails and returns the error message unsuccessfull signup! how can i correct this?
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com - No Copyright -->
<title>Arsiri Textile </title>
<meta charset="utf-8">
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com - No Copyright -->
<title>Arsiri Textile </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/basic.css">
<style>
</style>
</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">
<div class="header" style="height:60px;background:#330d00;width:1350px">
<a class="navbar-brand" href="#myPage">ARSIRI TEXTILE |</a>
<ul class="nav navbar-nav navbar-left">
</ul>
<ul class="nav navbar-nav navbar-right">
<li>About Us</li>
<li>Contact Us</li>
<li>Login</li>
<li> Signup</li>
</ul>
</div>
<div class="image" style="height:530px; width:1350px" >
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" />
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading" style="background:#330d00;">
<h3 class="panel-title">Customer Registration</h3><br>
</div>
<div class="panel-body" >
<form class="form-horizontal" role="form" action="signupaction.php" method="post" >
<div class="form-group">
<label for="name" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10" style="width:300px">
<input type="text" class="form-control" id="name" name="firstname" required>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10" style="width:300px">
<input type="text" class="form-control" id="name" name="lastname" required>
</div>
</div>
<div class="form-group">
<label for="Address" class="col-sm-2 control-label">Address</label>
<div class="col-sm-10" style="width:300px">
<textarea class="form-control" class="form-control" name="address"></textarea>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Contact No.</label>
<div class="col-sm-10" style="width:300px">
<input type="text" maxlength="10" class="form-control" id="name" name="contactno" required>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-Mail</label>
<div class="col-sm-10" style="width:300px">
<input type="email" class="form-control" id="name" name="emailaddress" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10" style="width:300px">
<input type="password" class="form-control" id="pass" name="password" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Confirm password
</label>
<div class="col-sm-10" style="width:300px">
<input type="password" class="form-control" id="confirmpass" name="cpassword" required><br>
</div>
</div>
<div class="panel-footer" style="overflow:hidden;text-align:left;">
<div class="col-sm-offset-2 col-sm-10">
<input class="btn btn-success btn-sm" type=submit name=submit value=Submit >
<input class="btn btn-success btn-sm" type=reset name=reset value=Cancel>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</div>
<div class="footer " style="background:#330d00; height:60px ;width:1350px ">
<p align="center" > Asiri all rights reserved</p>
</div>
The relevant php script(ignupaction.php) for the above html form is as follows
<?php
//importing db.php in the includes folder
require("includes/db.php");
$fname=$_POST["firstname"];
$lname=$_POST["lastname"];
$address=$_POST["address"];
$contact=$_POST["contactno"];
$email=$_POST["emailaddress"];
$password=$_POST["password"];
$cpassword=$_POST["cpassword"];
$sql="INSERT INTO `signup` VALUES ('$fname','$lname','$address','$contact','$email','$password',$cpassword')";
$result=mysqli_query($db,$sql);
if(!$result){
echo "Unsuccessful signup";
}
else{
echo "Successful signup";
}
?>
when the form is submitted it returns unsuccessful signup! how can i correect this?
$sql="INSERT INTO signup VALUES ('$fname','$lname','$address','$contact','$email','$password',$cpassword')";
you are missing a ' on the last variable. you have '$password',$cpassword' <----- missing '. Also change the ticks around 'signup'.
Try this :
$sql="INSERT INTO 'signup' VALUES ('$fname','$lname','$address','$contact','$email','$password','$cpassword')";

Categories