Reputation: 160
I am trying to get value from dynamic created input field But its not fetching. its fetching only static field row.
Bellow is my code
<input type="text" id="job_title_id" name ="job_title_id[]" value="<?php echo set_value('job_title_id'); ?>">
script for creating dynamic input box
$(document).ready(function() {
var max_fields = 3; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x = 1; //initlal text box count
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
if(x < max_fields){ //max input box allowed
x++; //text box increment
$(wrapper).append('<div class="detailroweno"><span class="code"><input type="text" name="job_title_id[]"/></span></div>'); //add input box
}
});
})
Once i submit the code i am trying to get value on controller in codeigniter by dynamic created field data is not displaying
I tried to display using bellow php code in controller once i click to submit form
print_r($_REQUEST);
$results=$this->input->post('job_title_id');
print_r($results);
even i follow this link http://www.infotuts.com/dynamically-add-input-fields-submit-to-database/ Please help me out of this.. Thanks in advance.
Upvotes: 1
Views: 912
Reputation: 3412
I was able to fix the issue by putting input tag into form. Your input tag isn't in form tag.
Upvotes: 0