hey guys. I have a form that generates new input fields via JavaScript on click. the inputs are successfully added to the FORM with the desired naming convention.
<input type="text" name="util_name0" id="util_name0" value="" /><br/>
<input type="button" onClick="newUtil(this)" value="Add New" />
newUtil()
ekler:
<input type="text" name="util_name1" id="util_name1" value="" />
Ancak yazdıktan sonra, print_r($_POST)
sadece 'util_name0
' listeler.
Normally i'd paste some code, but that's all i really need to do at this point... form is in an include called from parent.php. Javascript is called in parent.php
JS:
function newUtil(el) {
var newval = util_count++;
$('#qty').attr('value', newval);
$(el).before('-------------<br />
<div class="newUtilField">
<label for="util_type'+newval+'">Type (i.e. gas, electric...) '+newval+'</label><br />
<input type="text" name="util_type'+newval+'" id="util_type'+newval+'" value="" /><br /><br />
<label for="util_name'+newval+'">Company Name</label><br />
<input type="text" name="util_name'+newval+'" id="util_name'+newval+'" value="" /><br /><br />
<label for="util_number'+newval+'">Company Number</label><br />
<input type="text" name="util_number'+newval+'" id="util_number'+newval+'" value="" />
</div><br /><br />');
}