Hello,
The problem I am having is when the following script is executed within my page and the user submits the form, the variables passed to the GET array are duplicated only for the inputs created by my script. I have other inputs in the form that are created within the HTML of the page that work fine (i.e. they only try to pass their value once) but I cannot get my script to work properly. Here is my script:
var segments1 = new Array("Deer","Fish","Trees","Horses","FSU Torches","BR Cardinal");
var prices = new Array("45","50","65","80","95");
function segment_check() {
for (var i=0; i<document.segment_form.segments.length; i++) {
if (document.segment_form.segments[i].checked) {
var j = 1;
var segments = document.segment_form.segments[i].value;
//document.getElementById('segment_form').innerHTML = "";
for (var a=1; a<=segments; a++) {
document.getElementById('segment_form').innerHTML += "</br>Segment " + a + ": ";
for (var b=0; b<segments1.length; b++) {
document.getElementById('segment_form').innerHTML += "<label for='"+j+b+"'><input type='radio' name='segment_type_"+j+"' id='"+j+b+"' value='"+segments1[b]+"' /> "+segments1[b]+"</label>";
}
document.getElementById('segment_form').innerHTML += "<label for='"+j+b+"'><input type='radio' name='segment_type_"+j+"' id='"+j+b+"' value='Other"+[b]+"' /> Other**: </label>";
document.getElementById('segment_form').innerHTML += "<input type='text' name='segment_type_"+j+"' size='10' onFocus='check_other()' />";
j++;
}
document.getElementById('segment_form').innerHTML += "</br><p style='font-size:18'>Subtotal: $"+prices[i]+".00</p>";
}
}
}
function check_other() {
document.getElementById((document.activeElement.name).charAt((document.activeElement.name).length-1)+segments1.length).checked = true;
}
Here is an example of what the url looks like after the form containing this script has been submitted:
fire_ring_order.php?segments=3&segment_type_1=deer&segment_type_1=&segment_type_2=tree&segment_type_2=&etc.
The input (segments) created in my page only submits itself once, while anything created by the script (segment_type_1, segment_type_2, etc.) submits itself twice with the second, blank value overriding the first, correct value.
Any help would be greatly appreciated.
Thanks.