Can not edit date form in laravel - php

im very new at laravel, and now, I'm building an edit form and the date of Birth will always back to time "1-1-1970" everytime i want to change it.
Whats wrong with my code?
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="date_of_bday">
Date Of Birthday
<span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="single_cal1" type="text" class="form-control has-feedback-left #if($errors->has('date_of_bday')) parsley-error #endif"
name="date_of_bday" placeholder="Date Of Birthday" aria-describedby="inputSuccess2Status" value="{{ date('m/d/Y', strtotime($member->dob)) }}" required>
<span class="fa fa-calendar form-control-feedback left" aria-hidden="true"></span>
</div>
</div>

Use Carbon to parse the date and format it accordingly
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="date_of_bday">
Date Of Birthday
<span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="single_cal1" type="text" class="form-control has-feedback-left
#if($errors->has('date_of_bday')) parsley-error #endif"
name="date_of_bday"
placeholder="Date Of Birthday"
aria-describedby="inputSuccess2Status"
value="{{ Carbon\Carbon::parse($member->dob)->format('m/d/Y') }}"
required>
<span class="fa fa-calendar form-control-feedback left" aria-hidden="true"></span>
</div>
</div>

Related

Laravel 8 - Old inputs and validation error messages are not working

I am trying to display the error div below a certain field if the validation for that input failed along with the previous input on the designated field.
Here's my progress so far:
in my controller file inside the store function (UserController > store):
public function store(Request $request)
{
$validationRules = array(
'first_name' => 'required|min:2|max:150',
'last_name' => 'required|min:2|max:150',
'gender' => 'required',
'birthdate' => 'required',
'user_contact' => 'required|min:10|max:20',
'email' => 'required|unique:users|max:150'
);
$validator = Validator::make($request->all(), $validationRules);
if($validator->fails()){
//dd($validator)
return redirect(route('user.create'))->withInput()->withErrors($validator);
}
.....
When I try to print $validator using dd() it does not have any problem and it contains the validation error messages, all inputs and validation rules.
Here's my snippet code in the create.blade.php (view):
<form class="form-horizontal" method = "POST" action = "{{ route('user.store') }}">
#csrf
<div class="form-group row">
<div class="col-md-12">
<strong><font color="red">*</font> Indicates required fields.</strong>
</div>
<div class="col-md-4">
<label for="u_fname" class="col-sm-6 col-form-label">First Name <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_fname') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-user" aria-hidden="true"></i></span>
</div>
<input type="text"
class="form-control"
id="first_name"
name = "first_name"
value="{{ old('first_name') }}"
minlength="2"
maxlength="150"
required/>
#error('first_name')
<div class="alert-danger">{{$errors->first('first_name') }} </div>
#enderror
</div>
</div>
<div class="col-md-4">
<label for="u_lname" class="col-sm-6 col-form-label">Last Name <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_lname') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-user" aria-hidden="true"></i></span>
</div>
<input type="text"
class="form-control"
id="last_name"
name = "last_name"
value="{{ old('last_name') }}"
minlength="2"
maxlength="150"
required/>
#error('last_name')
<div class="alert-danger">{{$errors->first('last_name') }} </div>
#enderror
</div>
</div>
<div class="col-md-4">
<label for="u_gender" class="col-sm-6 col-form-label">Gender <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_gender') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-venus-mars"></i></span>
</div>
<select class = "form-control" id = "gender" name = "gender" required>
<option value = "M">Male</option>
<option value = "F">Female</option>
</select>
#error('gender')
<div class="alert-danger">{{$errors->first('gender') }} </div>
#enderror
</div>
</div>
<div class="col-md-4">
<label for="u_birthdate" class="col-sm-6 col-form-label">Birth Date <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_birthdate') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
</div>
<input type="text"
class="form-control"
id="birthdate"
name = "birthdate"
value="{{ old('birthdate') }}"
required/>
<div class="alert-danger">{{$errors->first('birthdate') }} </div>
</div>
</div>
<div class="col-md-4">
<label for="u_contact" class="col-sm-6 col-form-label">Contact Number <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_contact') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-phone"></i></span>
</div>
<input type="text"
class="form-control"
id="user_contact"
name = "user_contact"
value="{{ old('user_contact') }}"
onkeyup="this.value=this.value.replace(/[^\d]/,'')"
minlength="10"
maxlength="20"
required/>
#error('user_contact')
<div class="alert-danger">{{$errors->first('user_contact') }} </div>
#enderror
</div>
</div>
<div class="col-md-4">
<label for="u_email" class="col-sm-6 col-form-label">E-Mail Address<font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_email') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-at"></i></span>
</div>
<input type="email"
class="form-control"
id="email"
name = "email"
value="{{ old('email') }}"
minlength="10"
maxlength="150"
required/>
#error('email')
<div class="alert-danger">{{$errors->first('email') }} </div>
#enderror
</div>
</div>
<div class="col-md-4">
<label for="u_utype" class="col-sm-6 col-form-label">User Type <font color="red">*</font></label>
<div class="input-group mb-2 {{$errors->has('u_utype') ? 'has-error' : ''}}" >
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-user-cog"></i></span>
</div>
<select class = "form-control" id = "u_type_input" name = "u_type_input" required>
<option value = "E">Employee</option>
<option value = "A">Administrator</option>
</select>
#error('u_type_input')
<div class="alert-danger">{{$errors->first('u_type_input') }} </div>
#enderror
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-default float-right" name = "submit_create" id = "submit_create">Submit</button>
</div>
</form>
Notice that I removed the autocomplete=off because I read some posts that this causes the problem but still doesn't work in my case.
I've been reading all stackoverflow posts related on my problem but most of the scenario problem occured on Laravel 5 and I use the current latest version of Laravel Framework which is Laravel 8.
What seems to be the cause of the problem? and how should I retain the
old/previous inputs and show the error messages after the failed
validation? I suspect that the cause of the problem lies on the blade
file or related to the resources like bootstrap.
you can try this to redirect
if ($validator->fails())
{
return redirect()->back()->withErrors($validator->errors());
}
and while showing into the blade file try this one
#error('user_contact')
<div style="color: red;">{{ $message }}</div>
#enderror

Illegal offset type in isset or empty (Laravel 7)

I have some issues in my laravel project.
When I start my app and refresh the application in the browser
it shows me this error message:
Illegal offset type in isset or empty (View: /Users/inf/open-source/application/resources/views/auth/register.blade.php)
Middleware : Localization.php
<?php
namespace App\Http\Middleware;
use App;
use Closure;
class Localization
{
/**
* Handle an incoming request.
*
* #param \Illuminate\Http\Request $request
* #param \Closure $next
* #return mixed
*/
public function handle($request, Closure $next)
{
if (session()->has('locale')) {
App::setLocale(session()->get('locale'));
}
return $next($request);
}
}
Controllers : LocalizationController
<?php
namespace App\Http\Controllers\Web;
use App;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use RealRashid\SweetAlert\Facades\Alert;
class LocalizationController extends Controller
{
public function SiteLocalization($locale)
{
App::setLocale($locale);
// store the locale in session so that the middleware can register it
session()->put('locale', $locale);
toast('The language has been changed successfully.','success');
return redirect()->back();
}
}
Resources/auth/register.blade.php
<form id="registerForm" method="POST" action="{{ route('register') }}">
#csrf
<fieldset>
<div class="form-row">
<div class="form-group form-group-auth col-md-6 #error('firstname') is-invalid #enderror">
<label for="firstname">{{ __('First Name') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="people-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="firstname" class="form-control form-control-auth" name="firstname" value="{{ old('firstname') }}" placeholder="First Name *" autofocus />
</div><!-- End input-group -->
#error('firstname')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth col-md-6 #error('lastname') is-invalid #enderror">
<label for="lastname">{{ __('Last Name') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="people-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="lastname" class="form-control form-control-auth" name="lastname" value="{{ old('lastname') }}" placeholder="Last Name *" />
</div><!-- End input-group -->
#error('lastname')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
</div><!-- End form-row -->
<div class="form-group form-group-auth #error('name') is-invalid #enderror">
<label for="name">{{ __('Username') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="person-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="name" class="form-control form-control-auth" name="name" value="{{ old('name') }}" placeholder="Username *" />
</div><!-- End input-group -->
#error('name')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth #error('email') is-invalid #enderror">
<label for="email">{{ __('E-mail Address') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="mail-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="email" id="email" class="form-control form-control-auth" name="email" value="{{ old('email') }}" placeholder="E-mail Address *" />
</div><!-- End input-group -->
#error('email')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-row">
<div class="form-group form-group-auth col-md-6 #error('password') is-invalid #enderror">
<label for="password">{{ __('Password') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="ion" v-bind:class="[passwordIcon]" v-on:click="hidePassword = !hidePassword"></i>
</span>
</div><!-- End input-group-prepend -->
<input :type="passwordType"
v-model="registration.password"
id="password"
class="form-control form-control-auth"
name="password"
placeholder="Password *"
data-container="body"
data-toggle="popover"
data-trigger="hover"
data-placement="top"
data-content="Make sure it's at least 10 characters including a one lowercase letter, one uppercase letter, one digit, and special character." />
</div><!-- End input-group -->
#error('password')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth col-md-6 #error('password_confirmation') is-invalid #enderror">
<label for="password-confirm">{{ __('Confirm Password') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="ion" v-bind:class="[RepeatpasswordIcon]" v-on:click="hideRepeatPassword = !hideRepeatPassword"></i>
</span>
</div><!-- End input-group-prepend -->
<input :type="RepeatpasswordType"
v-model="registration.password_confirmation"
id="password-confirm"
class="form-control form-control-auth"
name="password_confirmation"
placeholder="Confirm Password *" />
</div><!-- End input-group -->
#error('password_confirmation')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ $message }}</p>
</div>
#enderror
</div><!-- End form-group -->
</div><!-- End form-row -->
</fieldset>
</form>
send $message value to blade
or
use # before variable
for example
{{ #$message }}
or
{{ #$message?:"default message" }}
<form id="registerForm" method="POST" action="{{ route('register') }}">
#csrf
<fieldset>
<div class="form-row">
<div class="form-group form-group-auth col-md-6 #error('firstname') is-invalid #enderror">
<label for="firstname">{{ __('First Name') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="people-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="firstname" class="form-control form-control-auth" name="firstname" value="{{ old('firstname') }}" placeholder="First Name *" autofocus />
</div><!-- End input-group -->
#error('firstname')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth col-md-6 #error('lastname') is-invalid #enderror">
<label for="lastname">{{ __('Last Name') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="people-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="lastname" class="form-control form-control-auth" name="lastname" value="{{ old('lastname') }}" placeholder="Last Name *" />
</div><!-- End input-group -->
#error('lastname')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
</div><!-- End form-row -->
<div class="form-group form-group-auth #error('name') is-invalid #enderror">
<label for="name">{{ __('Username') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="person-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="text" id="name" class="form-control form-control-auth" name="name" value="{{ old('name') }}" placeholder="Username *" />
</div><!-- End input-group -->
#error('name')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth #error('email') is-invalid #enderror">
<label for="email">{{ __('E-mail Address') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><ion-icon name="mail-outline"></ion-icon></span>
</div><!-- End input-group-prepend -->
<input type="email" id="email" class="form-control form-control-auth" name="email" value="{{ old('email') }}" placeholder="E-mail Address *" />
</div><!-- End input-group -->
#error('email')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-row">
<div class="form-group form-group-auth col-md-6 #error('password') is-invalid #enderror">
<label for="password">{{ __('Password') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="ion" v-bind:class="[passwordIcon]" v-on:click="hidePassword = !hidePassword"></i>
</span>
</div><!-- End input-group-prepend -->
<input :type="passwordType"
v-model="registration.password"
id="password"
class="form-control form-control-auth"
name="password"
placeholder="Password *"
data-container="body"
data-toggle="popover"
data-trigger="hover"
data-placement="top"
data-content="Make sure it's at least 10 characters including a one lowercase letter, one uppercase letter, one digit, and special character." />
</div><!-- End input-group -->
#error('password')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
<div class="form-group form-group-auth col-md-6 #error('password_confirmation') is-invalid #enderror">
<label for="password-confirm">{{ __('Confirm Password') }} <span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="ion" v-bind:class="[RepeatpasswordIcon]" v-on:click="hideRepeatPassword = !hideRepeatPassword"></i>
</span>
</div><!-- End input-group-prepend -->
<input :type="RepeatpasswordType"
v-model="registration.password_confirmation"
id="password-confirm"
class="form-control form-control-auth"
name="password_confirmation"
placeholder="Confirm Password *" />
</div><!-- End input-group -->
#error('password_confirmation')
<div class="invalid-feedback invalid-feedback-msg d-block">
<p class="mb-0"><span class="mr-1"><i class="fas fa-exclamation-triangle"></i></span> {{ #$message }}</p>
</div>
#enderror
</div><!-- End form-group -->
</div><!-- End form-row -->
</fieldset>
</form>

php - error in Autopopulate not working

<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Member No of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12">
<input required="" class="form-control col-md-7 col-xs-12" id="old_member_no" type="number" name="old_member_no" <?php if(isset($editData)) echo 'readonly style="pointer-events: none;"'; ?> value="{{ old('old_member_no',isset($editData) ? $editData->old_member_no:"") }}">
<input type="hidden" name="member_no" value="{{ old('member_no',isset($editData) ? $editData->member_no:"") }}" />
</div>
<span class="help-block"></span>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Name of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12 ">
<input required="" class="form-control col-md-7 col-xs-12" id="" type="text" name="full_name" value="{{ old('full_name',isset($editData) ? $editData->full_name:"") }}">
</div>
<span class="help-block"></span>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Address of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12 ">
<input required="" class="form-control col-md-7 col-xs-12" id="house" type="text" name="house" value="{{ old('house',isset($editData) ? $editData->house:"") }}">
</div>
<span class="help-block"></span>
</div>
Hello guys. I'm doing a project. I'm developing a form with autopopulate. If number is typed and after pressing enter the address and name should be fetched from database. kindly help me
Since it is not clear to me but base on your descriptions... You would need to use Javascript/JQuery here and use Event functions when the entering a field

Editing via function call PHP

I am wrapping functions in php pages in the functions.php and to access these pages, i put an action and a value in the url. I also have a function_calls.php which requests the action and its value and passes it to a switch case which calls the appropriate function. The problem i have is that i case i want to edit a field . I dont have an appropriate case(for the switch) which i want to look something like admin.php?action=edit?id=some_id.
function_calls.php
<?php
require_once "functions.php";
if (isset($_REQUEST['action'])) {
$option = $_REQUEST['action'];
echo $option;
switch ($option) {
case "complaints":
complaint();
break;
case "users":
users();
break;
case "officers":
officers();
break;
case "register_officer":
register_officer();
break;
case "register_student":
register_student();
break;
case "add_event":
add_event();
break;
default:
complaint();
break;
}
} else {
echo '<div class="jumbotron">
<h1>Welcome To The Administration Panel </h1>
<p>You can manage accounts and view the complaints here.</p>
</div>';
}
functions.php
<?php
include_once "include/db_connect.php";
function register_student()
{
?>
<section>
<div class="row">
<div class="col-md-7 col-md-offset-1">
<form class="" method="post" action="">
<div class="row">
<div class="col-md-6 ">
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Firstname" name="firstname" required=""
class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Lastname" name="lasttname" required=""
class="form-control">
</div>
</div>
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="text" placeholder="Email" name="email" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Registration Number" name="reg_no" required=""
class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-phone"></i></span>
<input type="text" placeholder="Phone" name="phone" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" placeholder="Password" name="password" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" placeholder="Confirm Password" name="conf_password" required=""
class="form-control">
</div>
<div class="row">
<!--<div class="col-md-6 checkbox">
<label><input type="checkbox">Remember me</label>
</div>-->
<div class="col-md-12">
<button class="btn btn-success btn-block pull-right" type="submit" name="register">Register
Student
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<?php
}
function register_officer()
{
?>
<section>
<div class="row">
<div class="col-md-7 col-md-offset-1">
<form class="" method="post" action="register.php">
<div class="row">
<div class="col-md-6 ">
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Firstname" name="firstname" required=""
class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Lastname" name="lastname" required=""
class="form-control">
</div>
</div>
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="text" placeholder="Email" name="email" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" placeholder="Rank" name="rank" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-phone"></i></span>
<input type="text" placeholder="Phone" name="phone" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" placeholder="Password" name="password" required="" class="form-control">
</div>
<div class="input-group margin-bottom-20">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" placeholder="Confirm Password" name="conf_password" required=""
class="form-control">
</div>
<div class="row">
<!--<div class="col-md-6 checkbox">
<label><input type="checkbox">Remember me</label>
</div>-->
<div class="col-md-12">
<button class="btn btn-success btn-block pull-right" type="submit" name="register_officer">
Register Officer
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<?php
}
This would be a bit more elegant solution than yours:
<?php
require_once 'functions.php';
if (isset($_GET['action'])) {
$option = $_GET['action'];
echo $option;
if(in_array($option, get_defined_functions()['user']) === true) {
call_user_func($option);
} else {
complaint();
}
} else {
echo '<div class="jumbotron">
<h1>Welcome To The Administration Panel </h1>
<p>You can manage accounts and view the complaints here.</p>
</div>';
}
So then you can define a function edit() which will be automatically called by the call_user_func without altering the switch each time you add a new function.

can't tap on a php included section on mobile

I have an HTML page where a form section is included like this :
<?php include 'templates/register-form.php'?>
In a web browser there is no problem and everythig is working .
But on mobile , i can see the section , but cannot tap on it , the input doesn't react and neither the buttons .
What can it be?
thanx!
the code below is the included section.
<form role="form">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="nusername" language="en">username :</label>
<input type="text" class="form-control input-sm login-input" name="nusername" placeholder="שם משתמש" value="<?php echo Input::get('username')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="fullname" language="en">full name :</label>
<input type="text" class="form-control input-sm login-input" name="fullname" placeholder="שם מלא" value="<?php echo Input::get('fullname')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="npassword" language="en">password :</label>
<input type="password" class="form-control input-sm login-input" name="npassword" placeholder="שם מלא" value="<?php echo Input::get('password')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="password_again" language="en">password again :</label>
<input type="password" class="form-control input-sm login-input" name="password_again" placeholder="הקלד את הסיסמא שנית" value="<?php echo Input::get('password_again')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="email" language="en">email:</label>
<input type="email" class="form-control input-sm login-input" name="email" placeholder="אי-מייל" value="<?php echo Input::get('email')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="adress" language="en">adress:</label>
<input type="text" class="form-control input-sm login-input" name="adress" placeholder="כתובת" value="<?php echo Input::get('adress')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="phone" language="en">phone:</label>
<input type="tel" class="form-control input-sm login-input" name="phone" placeholder="טלפון" value="<?php echo Input::get('phone')?>">
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<a class="form-control input-sm register-button btn btn-success pull-left" name="register-button" >הירשם</a>
</div>
</div>
In each field, your label attaches to the input field using the for-attribute. Safari connects for-attributes to id's, not names. Add the correct id to each of your inputs.
Example:
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="nusername" language="en">username :</label>
<input type="text" class="form-control input-sm login-input" id="username" name="nusername" placeholder="שם משתמש" value="<?php echo Input::get('username')?>">
</div>
</div>
Also, I suspect you just left it out of your example, but don't forget your tag, which might cause some issues in the Browser.

Categories