Code of jquery:-
$(".add-education").on('click', function () {
var educationcontent = '<div >'
'<div >'
'<div >'
'<div >'
'<div >'
'<label>Degree</label>'
'<input type="text" name="degree1">'
'</div>'
'</div>'
'<div >'
'<div >'
'<label>College/Institute</label>'
'<input type="text" name="clg1">'
'</div>'
'</div>'
'<div >'
'<div >'
'<label>Year of Completion</label>'
'<input type="text" name="yoc1">'
'</div>'
'</div>'
'</div>'
'</div>'
'<div ><label > </label><a href="#" ><i ></i></a></div>'
'</div>';
// edu ;
$(".education-info").append(educationcontent);
return false;
});
Here i am not getting output of dynamically added textbox's input in post method of form,
in the image the 2nd line or divison is added textbox dynamically
code of controller for laravel post method
public function drprofilesettingpost(Request $request){
dd($request->all());
}
The output gives only null value for the dynamically added textbox
The php blade template here
@include('doctor.navbar')
<!-- Breadcrumb -->
<div >
<div >
<div >
<div >
<nav aria-label="breadcrumb" >
<ol >
<li ><a href="index-2.html">Home</a></li>
<li aria-current="page">Profile Settings</li>
</ol>
</nav>
<h2 >Profile Settings</h2>
</div>
</div>
</div>
</div>
</div>
<div >
<!-- Basic Information -->
<div >
<div >
<h4 >Basic Information</h4>
<div >
<div >
<div >
<div >
<div >
<img src="{{url('/')}}/assets/img/doctors/doctor-thumb-02.jpg" alt="User Image">
</div>
<form method="post" action="{{url('/')}}/doctor/profilesetting">
@csrf
<div >
<div >
<span><i ></i> Upload Photo</span>
<input type="file" >
</div>
<small >Allowed JPG, GIF or PNG. Max size of 2MB</small>
</div>
</div>
</div>
</div>
<div >
<div >
<label>Username <span >*</span></label>
<label >{{$userinfo->username;}}</label>
</div>
</div>
<div >
<div >
<label>Email <span >*</span></label>
<label >{{$userinfo->email;}}</label>
</div>
</div>
<div >
<div >
<label>First Name <span >*</span></label>
<input type="text" value="{{$userinfo->firstname;}}">
</div>
</div>
<div >
<div >
<label>Last Name <span >*</span></label>
<input type="text" value="{{$userinfo->lastname;}}">
</div>
</div>
<div >
<div >
<label>Phone Number</label><span >*</span>
<input type="text" value="{{$userinfo->phoneno;}}">
</div>
</div>
<div >
<div >
<label>Gender</label><span >*</span>
<select >
<option>Select</option>
<option
@if($userinfo->gender == 'M')
selected='selected'
@endif
>Male</option>
<option
@if($userinfo->gender == 'F')
selected='selected'
@endif
>Female</option>
<option
@if($userinfo->gender == 'O')
selected='selected'
@endif
>Other</option>
</select>
</div>
</div>
<div >
<div >
<label>Date of Birth</label><span >*</span>
<input type="text" value="{{$userinfo->dob}}">
</div>
</div>
</div>
</div>
</div>
<!-- /Basic Information -->
<!-- About Me -->
<div >
<div >
<h4 >About Me</h4>
<div >
<label>Biography</label>
<textarea rows="5">{{$userinfo->biography}}</textarea>
</div>
</div>
</div>
<!-- /About Me -->
<!-- Clinic Info -->
<div >
<div >
<h4 >Clinic Info</h4>
<div >
<div >
<div >
<label>Clinic Name</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>Clinic Address</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>Clinic Images</label>
{{-- <form action="#" ></form> --}}
</div>
<div >
<div >
<img src="{{url('/')}}/assets/img/features/feature-01.jpg" alt="Upload Image">
<a href="javascript:void(0);" ><i ></i></a>
</div>
<div >
<img src="{{url('/')}}/assets/img/features/feature-02.jpg" alt="Upload Image">
<a href="javascript:void(0);" ><i ></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /Clinic Info -->
<!-- Contact Details -->
<div >
<div >
<h4 >Contact Details</h4>
<div >
<div >
<div >
<label>Address Line 1</label>
<input type="text" value="{{$userinfo->address1}}">
</div>
</div>
<div >
<div >
<label >Address Line 2</label>
<input type="text" value="{{$userinfo->address2}}">
</div>
</div>
<div >
<div >
<label >City</label>
<input type="text" value="{{$userinfo->city}}">
</div>
</div>
<div >
<div >
<label >State / Province</label>
<input type="text" value="{{$userinfo->state}}">
</div>
</div>
<div >
<div >
<label >Country</label>
<input type="text" value="{{$userinfo->country}}">
</div>
</div>
<div >
<div >
<label >Postal Code</label>
<input type="text" value="{{$userinfo->pincode}}">
</div>
</div>
</div>
</div>
</div>
<!-- /Contact Details -->
<!-- Pricing -->
<div >
<div >
<h4 >Pricing</h4>
<div >
<div >
<div >
<label>GENERAL CONSTANT PRICE</label>
<input type="number" value="{{$userinfo->generel_cons_price}}">
</div>
</div>
<div >
<div >
<label >VIDEO-CALL PRICE</label>
<input type="number" value="{{$userinfo->videocallprice}}">
</div>
</div>
<div >
<div >
<label >VOICE-CALL PRICE</label>
<input type="number" value="{{$userinfo->voicecallprice}}">
</div>
</div>
</div>
</div>
<!-- /Pricing -->
<!-- Services and Specialization -->
<div >
<div >
<h4 >Services and Specialization</h4>
<div >
<label>Services</label>
{{-- <input type="text" data-role="tagsinput" placeholder="Enter Services" name="services" value="HI" id="services"> --}}
<input type="text" data-role="tagsinput" placeholder="Enter Services" name="services" value="{{$userinfo->services}}" id="services">
<small >Note : Type & Press enter to add new services</small>
</div>
<div >
<label>Specialization </label>
<input type="text" data-role="tagsinput" placeholder="Enter Specialization" name="specialist" value="{{$userinfo->specialization}}" id="specialist">
<small >Note : Type & Press enter to add new specialization</small>
</div>
</div>
</div>
<!-- /Services and Specialization -->
<!-- Education -->
<div >
<div >
<h4 >Education</h4>
<div >
<div >
<div >
<div >
<div >
<div >
<label>Degree</label>
<input type="text" name="degree">
</div>
</div>
<div >
<div >
<label>College/Institute</label>
<input type="text" name="clg">
</div>
</div>
<div >
<div >
<label>Year of Completion</label>
<input type="text" name="yoc">
</div>
</div>
</div>
</div>
</div>
</div>
<div >
<a href="javascript:void(0);" ><i ></i> Add More</a>
</div>
</div>
</div>
<!-- /Education -->
<!-- Experience -->
<div >
<div >
<h4 >Experience</h4>
<div >
<div >
<div >
<div >
<div >
<div >
<label>Hospital Name</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>From</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>To</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>Designation</label>
<input type="text" >
</div>
</div>
</div>
</div>
</div>
</div>
<div >
<a href="javascript:void(0);" ><i ></i> Add More</a>
</div>
</div>
</div>
<!-- /Experience -->
<!-- Awards -->
<div >
<div >
<h4 >Awards</h4>
<div >
<div >
<div >
<div >
<label>Awards</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>Year</label>
<input type="text" >
</div>
</div>
</div>
</div>
<div >
<a href="javascript:void(0);" ><i ></i> Add More</a>
</div>
</div>
</div>
<!-- /Awards -->
<!-- Memberships -->
<div >
<div >
<h4 >Memberships</h4>
<div >
<div >
<div >
<div >
<label>Memberships</label>
<input type="text" >
</div>
</div>
</div>
</div>
<div >
<a href="javascript:void(0);" ><i ></i> Add More</a>
</div>
</div>
</div>
<!-- /Memberships -->
<!-- Registrations -->
<div >
<div >
<h4 >Registrations</h4>
<div >
<div >
<div >
<div >
<label>Registrations</label>
<input type="text" >
</div>
</div>
<div >
<div >
<label>Year</label>
<input type="text" >
</div>
</div>
</div>
</div>
<div >
<a href="javascript:void(0);" ><i ></i> Add More</a>
</div>
</div>
</div>
<!-- /Registrations -->
<div >
<button type="submit" >Save Changes</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- /Page Content -->
</div>
<script src="{{url('/')}}/assets/js/jquery.min.js"></script>
<script src="{{url('/')}}/assets/js/popper.min.js"></script>
<script src="{{url('/')}}/assets/js/bootstrap.min.js"></script>
<script src="{{url('/')}}/assets/plugins/theia-sticky-sidebar/ResizeSensor.js"></script>
<script src="{{url('/')}}/assets/plugins/theia-sticky-sidebar/theia-sticky-sidebar.js"></script>
<script src="{{url('/')}}/assets/plugins/select2/js/select2.min.js"></script>
<script src="{{url('/')}}/assets/plugins/dropzone/dropzone.min.js"></script>
<script src="{{url('/')}}/assets/plugins/bootstrap-tagsinput/js/bootstrap-tagsinput.js"></script>
<script src="{{url('/')}}/assets/js/profile-settings.js"></script>
<script src="{{url('/')}}/assets/js/script.js"></script>
</body>
</html>
CodePudding user response:
Your form submit was not sending all the data because your form tags were not correctly placed in the HTML content, and therefore you were confusing the browser of which elements to include in the form submit.
Move your opening form tag before this line <div >
.