Update user profile Laravel - php

I have a problem, I cannot update the user profile, when I press "submit" I will get an expired page, how can I solve it?
My form:
<form method="post" class ="tab-pane" id ="edit" action="{{route('profile')}}">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Email</label>
<div class="col-lg-9">
<input class="form-control" type="email" value={{$user->email}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">About</label>
<div class="col-lg-9">
<input class="form-control" type="text" value={{$user->about}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Skills</label>
<div class="col-lg-9">
<input class="form-control" type="text" value={{$user->skills}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Hobbies</label>
<div class="col-lg-9">
<input class="form-control" type="text" value={{$user->hobbies}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Address</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" placeholder="Street">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label"></label>
<div class="col-lg-6">
<input class="form-control" type="text" value="" placeholder="City">
</div>
<div class="col-lg-3">
<input class="form-control" type="text" value="" placeholder="State">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Username</label>
<div class="col-lg-9">
<input class="form-control" type="text" value={{$user->name}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Password</label>
<div class="col-lg-9">
<input class="form-control" type="password" value={{$user->password}}>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label"></label>
<div class="col-lg-9">
<input type="reset" class="btn btn-secondary" value="Cancel">
<<button type="submit">submit</button>
</div>
</div>
</form>
</div>
</div>
My route:
Route::post('/profile', 'UserController#update_Profile');
And my UserController:
public function update_Profile(User $user) {
$this->validate(request(), [
'name' => 'required',
'email' => 'required|email|unique:users',
]);
$user->name = Request::input('name');
$user->email = Request::input('email');
$user->save();
Flash::message('Your account has been updated!');
return back();
}
I tried different methods through topics but failed, what do you think is the problem? Maybe because of how I defined view or because of the route?

Put #CSRF in your form.
Like so:
<form method="post" class ="tab-pane" id ="edit" action="{{route('profile')}}">
#csrf
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Email</label>
<div class="col-lg-9">
<input class="form-control" type="email" value={{$user->email}}>
</div>
</div>
...
...
</form>
See this: https://laravel.com/docs/5.8/csrf

Related

how to solve Call to a member function update() on null on laravel 8?

I am getting this kind of error call to member function update on null(). shown my code below please anyone can solve
all are the things are fine when am getting to the image file update in that time am getting this error.
here is my controller code
////
function user_update(Request $request){
$user= User::findOrFail($request->id)->update([
'name'=>$request->name,
'email'=>$request->email,
'address'=>$request->address,
'nationality'=>$request->nationality,
'date_of_birth'=>$request->date_of_birth,
'father_name'=>$request->father_name,
'mother_name'=>$request->mother_name,
'gender'=>$request->gender,
'n_photo'=>$request->n_photo,
]);
if ($request->hasFile('n_photo')) {
$photo_upload = $request ->n_photo;
$photo_extension = $photo_upload -> getClientOriginalExtension();
$photo_name = "toletx_auth_image_". $user . "." . $photo_extension;
Image::make($photo_upload)->resize(452,510)->save(base_path('public/uploads/auth/'.$photo_name),100);
User::find($user)->update([
'n_photo' => $photo_name,
]);
}
return back()->with('success','User information have been successfully Updated.');
}
///////my blade file
<form method="POST" action="{{ route('user_update') }}" enctype="multipart/form-data">
#csrf
<div class="form-group row">
<input type="text" name="id" value="{{$list->id}}">
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">User name</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->name}}" name="name" placeholder="Location" type="text" >
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Email</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->email}}" name="email" placeholder="Location" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Mobile Number</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->phone}}" name="phone" placeholder="Location" type="text" >
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Address</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->address}}" name="address" placeholder="Location" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Nationality</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" name="nationality" value="{{$list->nationality}}" placeholder="nationality" type="numeric">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Date of birth</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="Birth Date" name="date_of_birth" value="{{$list->date_of_birth}}">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Father Name</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="Father name" name="father_name" value="{{$list->father_name}}">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Mother Name</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="mother name" name="mother_name" value="{{$list->mother_name}}">
</div>
</div>
<div class="form-group">
<div class="form-group form-float">
<div class="card">
<div class="body">
<input type="file" class="dropify" name="n_photo" >
<img src="{{ asset('uploads/auth') }}/{{ $list->n_photo }}" alt="">
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Update</button>
You've got 2 main problems with this code:
User::find($user)->update(['n_photo' => $photo_name]);
First of all, the correct syntax would be to use $user->id, not $user:
User::find($user->id)->update(['n_photo' => $photo_name]);
Second, that is super redundant; $user is already the result of User::find(), so you're doubling up for no reason.
To fix your issue, simply adjust your code to:
$user->update(['n_photo' => $photo_name]);
Just spacing issue please check these two lines
//Before // Wrong
$photo_upload = $request ->n_photo;
$photo_extension = $photo_upload -> getClientOriginalExtension();
//After //Correct
$photo_upload = $request->n_photo;
$photo_extension = $photo_upload->getClientOriginalExtension();
function user_update(Request $request){
$photo_name = '';
$user= User::findOrFail($request->id);
if ($request->hasFile('n_photo')) {
$photo_upload = $request->n_photo;
$photo_extension = $photo_upload->getClientOriginalExtension();
$photo_name = "toletx_auth_image_". $user . "." . $photo_extension
Image::make($photo_upload)->resize(452,510)->save(base_path('public/uploads/auth/'.$photo_name),100);
}
$user->update([
'name'=>$request->name,
'email'=>$request->email,
'address'=>$request->address,
'nationality'=>$request->nationality,
'date_of_birth'=>$request->date_of_birth,
'father_name'=>$request->father_name,
'mother_name'=>$request->mother_name,
'gender'=>$request->gender,
'n_photo'=>$photo_name,
]);
}
return back()->with('success','User information have been successfully Updated.');
}

How do I limit registration in my Laravel application?

I have a Laravel application with a registration form, and anyone can register multiple accounts.
I want to limit the registration to one account per IP address. How do I achieve this? I also want to only accept Gmail.
Here is my registration form:
<h4> {{ $page_title }} </h4>
<span class="liner"></span>
<div class="row">
<div class="col-md-6 col-md-offset-2 col-sm-12">
<h4> Registration </h4>
<span class="liner"></span>
<div class="widget-content clearfix">
<form action="{{ route('post-member') }}" method="post" class="form-horizontal" enctype="multipart/form-data">
{!! csrf_field() !!}
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Member Plan</label>
<div class="col-sm-8">
<select name="price_id" id="" class="form-control" required>
#foreach($price as $p)
#if($p->id == $pr)
<option value="{{ $p->id }}" selected>{{ $p->title }} - {{ $general->currency }} {{ $p->price }}</option>
#else
<option value="{{ $p->id }}">{{ $p->title }} - {{ $general->currency }} {{ $p->price }}</option>
#endif
#endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Name</label>
<div class="col-sm-8">
<input type="text" name="name" class="form-control" id="inputEmail3" placeholder="Name" required>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Email</label>
<div class="col-sm-8">
<input type="email" name="email" class="form-control" id="inputEmail3" placeholder="Email" required>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Phone</label>
<div class="col-sm-8">
<input type="text" name="phone" required class="form-control" id="inputEmail3" placeholder="Phone">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Address</label>
<div class="col-sm-8">
<textarea name="address" id="" cols="30" rows="3"
class="form-control" required></textarea>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Profile Picture</label>
<div class="col-sm-8">
<input type="file" name="image" id="" required class="form-control">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-3 control-label">Password</label>
<div class="col-sm-8">
<input type="password" required name="password" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-3 control-label">Confirm Password</label>
<div class="col-sm-8">
<input type="password" required name="password_confirmation" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<button type="submit" class="btn btn-default"><i class="fa fa-send"></i> Registration</button>
</div>
</div>
</form>

laravel get parameter from url to pass it with the action of the form

so i have this problem that i can't get pass it, i'm trying to get an parameter i sent with this view
#if(Auth::user())
Apply
#else
Apply
#endif
when the user isn't login it redirect him to the register form and it send the 'VacanciesID' to the register form, so its there in the url but i can't get the parameter of the url to the blade to send it with the action of the form that looks like this /careers/1/apply i need '1'.
heres my register form
<form action="/register/" method="POST" class="careersform">
<input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" />
<h4>User Details</h4>
<hr>
<div class="row">
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Username</label>
<input name="EmployeeUsername" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Password</label>
<input name="EmployeePassword" type="text" class="form-control">
</div>
</div>
</div>
<h4>Personal Details</h4>
<hr>
<div class="row">
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>First Name</label>
<input name="FName" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Last Name</label>
<input name="LName" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Gender</label>
<select name="Gender" class="form-control">
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Date of Birth</label>
<input name="DOB" type="date" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Marital Status</label>
<select name="MaritalStatus" class="form-control">
<option>Single</option>
<option>Married</option>
<option>Other</option>
</select>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Country of Nationality</label>
<select name="CountryOfNationality" class="form-control">
<option>Jordan</option>
<option>Other..</option>
</select>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>National ID</label>
<input name="NationID" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Image</label>
<input name="Image" type="file" class="form-control">
</div>
</div>
<div class="form-group col-md-6 col-xs-12">
<img id="ImgUpload" src="/images/avatar.png" alt="Uploaded Image"/>
</div>
</div>
<h4>Education Details</h4>
<hr>
<div class="row">
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>School's Name</label>
<input name="SchoolName" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Education Level</label>
<select name='EducationLevel' class="form-control">
<option>High school</option>
<option>Some college</option>
<option>Bachelor's degree</option>
<option>Master's degree</option>
</select>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Major</label>
<input name="EducationMajor" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>GPA</label>
<input name="GBA" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Add Another Education</label>
<input name="education" type="text" class="form-control">
</div>
</div>
</div>
<h4>Experience Details</h4>
<hr>
<div class="row">
<div class="col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Company's Name</label>
<input name="CompanyName" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Job Title</label>
<input name="JobTitle" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Salary</label>
<input name="Salary" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Start date</label>
<input name="StartDate" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>End date</label>
<input name="EndDate" type="text" class="form-control">
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group careersform-group-styled required">
<label>Add Another Experience</label>
<input name="anotherexperience" type="text" class="form-control">
</div>
</div>
</div>
<button type="submit" class="btn turquoiseButton">Submit</button>
</form>
register route:
Route::post('register/', 'UsersController#careerportalregister');
controller:
public function careerportalregister(request $request){
$EmployeeUsername = $request->input('username');
$EmployeePassword = $request->input('password');
$role_id = $request->input('role_id');
$rol = $request->input('roles');
$roles= explode("," ,$rol);
$validator = Validator::make($request->all(), [
'password' => 'required|min:5|confirmed',
'confirm_password' => 'required|min:6|confirmed'
]);
// if ($validator->fails()) {
// return redirect('/user/create')
// ->withErrors($validator)
// ->withInput();
// } else {
$employee = user::create([
'username' => $request->input('EmployeeUsername'),
'password' => bcrypt($request->input('EmployeePassword')),
]);
$Title = $request->input('Title');
$Gender = $request->input('Gender');
$FName = $request->input('FName');
$LName = $request->input('LName');
$DOB = $request->input('DOB');
$MaritalStatus = $request->input('MaritalStatus');
$CountryOfBirth = $request->input('CountryOfBirth');
$CountryOfNationality = $request->input('CountryOfNationality');
$NationID = $request->input('NationID');
$Image = $request->input('Image');
$user_id = $employee->id;
PersonalDetails::CreatePersonalDetails($Title,$Gender ,$FName ,$LName,$DOB,$MaritalStatus,$CountryOfBirth,$CountryOfNationality,$NationID,$Image,$user_id);
$EducationMajor = $request->input('EducationMajor');
$EducationLevel = $request->input('EducationLevel');
$SchoolName = $request->input('SchoolName');
$GBA = $request->input('GBA');;
$user_id = $employee->id;
EducationDetails::CreateEducationDetails($EducationMajor,$EducationLevel ,$SchoolName ,$GBA,$user_id);
$CompanyName = $request->input('CompanyName');
$StartDate = $request->input('StartDate');
$EndDate = $request->input('EndDate');
$Salary = $request->input('Salary');
$JobTitle = $request->input('JobTitle');
$UserID = $employee->id;
ExperienceDetails::CreateExperienceDetails($CompanyName,$StartDate ,$EndDate ,$Salary,$JobTitle,$UserID);
foreach ($roles as $role) {
$count = DB::table('roles')->where('name', $role)->count();
if ($count != 0) {
$s = DB::table('roles')->where('name', $role)->first();
DB::table('role_user')->insert([
'user_id' => $employee->id,
'role_id' => $s->id
]);
}
}
Auth::login($employee, $remember = true);
return Redirect::to('/apply/success/');
}
In controller \Request::segment(2)
In blade {{Request::segment(2)}}
2 is the index number, feel free to change it based on your needs.
I would pass the id to the register url as an optional parameter.
Like this :
Route::post('register/{vacanciesId?}', 'UsersController#careerportalregister');
Then get it in the controller and do what you want with it.
You could also save it in session.
Have a nice day,
Assuming this is on your vacancies page and the problem you are having is that you are not able to put the ID into the url you need to iterate through each vacancy and set the ID that way so that the links are generated with a unique ID for each vacancy.
Also considering you have two different ways to provide details for the vacancy you would need to to create two Route::Get' for /apply/success/{{id}} and /careers/{{id}}/apply
When displaying the vacancies, I assume you are retrieving from the datebase and iterating through the results to show in the view? You should edit your post and display that.

Laravel : How to make a page submit to itself

I'm working on a page for editing user profiles but I want the page am working on to submit to itself when it is submitted and show a message that the profile has been edited successfully. Please how do I do this ?
Here is what am working ?
<div class="row">
<div class="text-center title">Pricing</div>
<div class="text-center desc col-md-8 col-md-push-2">
{{$sitename}}
</div>
<div class="container" style="padding-top: 60px;">
<h1 class="page-header">Edit Profile</h1>
<div class="row">
<!-- left column -->
<form class="form-horizontal" role="form" method="post" action="/profile">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="text-center">
<img id="ShowImage" src="#"/>
<img src="http://localhost:8234/img/index.png" class="avatar img-circle img-thumbnail" alt="avatar" width="200" height="200">
<h6>Upload a different photo...</h6>
<input type="file" class="text-center center-block well well-sm" name="avatar_path" id="avatar_path" onchange="readURL(this);">
</div>
</div>
<!-- edit form column -->
<div class="col-md-8 col-sm-6 col-xs-12 personal-info">
<div class="alert alert-info alert-dismissable">
<a class="panel-close close" data-dismiss="alert">×</a>
<i class="fa fa-coffee"></i>
This is the <strong>Profile Page</strong>. Use this to <strong>ONLY</strong> change your peronsal details
</div>
<h3>Personal info</h3>
<input class="form-control" value="{{$userInfo['data']['id']}}" type="hidden" name="user_id">
<div class="form-group">
<label class="col-lg-3 control-label">First Name:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['first_name']}}" type="text" name="first_name">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Last Name:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['last_name']}}" type="text" name="last_name">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Username:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['username']}}" type="text" name="username">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email Address:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['email']}}" type="text" name="email">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Gender</label>
<div class="col-lg-8">
<div class="ui-select">
<select id="gender" class="form-control" name="gender">
<option value="{{$userInfo['data']['profile']['gender']}}" selected>{{$userInfo['data']['profile']['gender']}}</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">City:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['city']}}" type="text" name="city">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">State:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['state']}}" type="text" name="state">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Country:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['country']}}" type="text" name="country">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Mobile:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['mobile']}}" type="text" name="mobile">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Occupation:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['occupation']}}" type="text" name="occupation">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input class="bkgrnd-blue text-white btn btn-primary" value="Update Profile" type="submit">
<span></span>
Cancel
</div>
</div>
</form>
</div>
</div>
</div>
This solution came from https://laravel.io/forum/01-30-2015-form-submission-to-the-same-page. Hope it helps
I have done a get route to display the page. I then did route a post to post form data.
Then I passed the $data variable to blade where I did an isset to check if it is created which displays the results
Display initial page
public function destinationSearchGet(){
$headData = array('pageTitle' => 'Admin Home - View all destinations');
return view('admin.destination_search', $headData);
}
post data back to the same page and create a new variable
public function destinationSearchPost(){
$headData = array('pageTitle' => 'Admin Home - Search results');
$formData = Request::input('destination');
$data = ParentRegionList::destinationSearch($formData);
return view('admin.destination_search', $headData)->with(compact('data'))
}
use blade to check if it exists
#if (isset($data))
<p>{{dd($data)}}</p>
#endif

Web site send message

When i post a Message from my web page it returns a ? in the browser such as this,
I believe both the HTML and the php to be correct
The html......
`enter code here`
<form class="form-horizontal">
<fieldset>
<div class="form-group is-empty">
<label for="Name" class="col-md-2 control- label">Name</label>
<div class="col-md-10">
<input type="text" class="form-control" id="Name" placeholder="Name">
</div>
</div>
<div class="form-group is-empty">
<label for="Email" class="col-md-2 control-label">Email</label>
<div class="col-md-10">
<input type="email" class="form-control" id="Email" placeholder="Email">
</div>
</div>
<div class="form-group is-empty">
<label for="Message" class="col-md-2 control-label">Message</label>
<div class="col-md-10">
<input type="text" class="form-control" id="Message" placeholder="Message">
</div>
</div>
<div class="form-group">
<form action="sendcontact.php" method="post">
<div class="col-md-10 col-md-offset-2">
<button type="submit">Send Message</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</section>
enter code here
you have declare form method and its action in form tag. Something like as follows
<form action="actionPage.php" method="POST"> //you can send data in get method or post method
Hope this will work for you...
action="yourLoctionUrl" tell the form where to submit data.
if you will do it empty then it will show ?yourinput fields&other inputs
<form action="sendcontact.php" method="post" class="form-horizontal">
<fieldset>
<div class="form-group is-empty">
<label for="Name" class="col-md-2 control- label">Name</label>
<div class="col-md-10">
<input type="text" class="form-control" id="Name" placeholder="Name">
</div>
</div>
<div class="form-group is-empty">
<label for="Email" class="col-md-2 control-label">Email</label>
<div class="col-md-10">
<input type="email" class="form-control" id="Email" placeholder="Email">
</div>
</div>
<div class="form-group is-empty">
<label for="Message" class="col-md-2 control-label">Message</label>
<div class="col-md-10">
<input type="text" class="form-control" id="Message" placeholder="Message">
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2">
<button type="submit">Send Message</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
You have used form tag twice in your coding. put your action and post in starting form tag as i did.
You didn't close the second form tag. Go for this:
<form action="sendcontact.php" method="post">
<div class="col-md-10 col-md-offset-2">
<button type="submit">Send Message</button>
</div>
</form>

Categories