I have a piece of javascript that works exactly how I want it, but now I need to make it less unweildy.

Essentially, I have 25 copies of this code, with the "testform1" increasing to "testform2," testform3," ... "testform25." In addition, each of the sections echoes php code "name_product_1," "name_product_2," ... "name_product_13."

Certainly a loop would fix the first problem, if not both? I know how to loop a document.write method, but I don't know how to loop within the javascript itself.

Code:
<script language="JavaScript">
function textValue() {   
var searchInteger, searchString       
testInteger=document.testform1.testselect.selectedIndex 
testString=document.testform1.testselect.options[testInteger].text
if (testInteger=document.testform1.testselect.options[0].selected) { 
document.testform1.testtext.value = "No package selected";}
else if (testInteger=document.testform1.testselect.options[1].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_1',0); ?>";}
else if (testInteger=document.testform1.testselect.options[2].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_2',0); ?>";}
else if (testInteger=document.testform1.testselect.options[3].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_3',0); ?>";}
else if (testInteger=document.testform1.testselect.options[4].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_4',0); ?>";}
else if (testInteger=document.testform1.testselect.options[5].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_5',0); ?>";}
else if (testInteger=document.testform1.testselect.options[6].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_6',0); ?>";}
else if (testInteger=document.testform1.testselect.options[7].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_7',0); ?>";}
else if (testInteger=document.testform1.testselect.options[8].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_8',0); ?>";}
else if (testInteger=document.testform1.testselect.options[9].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_9',0); ?>";}
else if (testInteger=document.testform1.testselect.options[10].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_10',0); ?>";}
else if (testInteger=document.testform1.testselect.options[11].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_11',0); ?>";}
else if (testInteger=document.testform1.testselect.options[12].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_12',0); ?>";}
else if (testInteger=document.testform1.testselect.options[13].selected) { 
document.testform1.testtext.value = "<?php echo $orders_row->getField('name_product_13',0); ?>";}
}
</script>


<script language="JavaScript">
function textValue() {   
var searchInteger, searchString       
testInteger=document.testform2.testselect.selectedIndex 
testString=document.testform2.testselect.options[testInteger].text
if (testInteger=document.testform2.testselect.options[0].selected) { 
document.testform2.testtext.value = "No package selected";}
else if (testInteger=document.testform2.testselect.options[1].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_1',0); ?>";}
else if (testInteger=document.testform2.testselect.options[2].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_2',0); ?>";}
else if (testInteger=document.testform2.testselect.options[3].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_3',0); ?>";}
else if (testInteger=document.testform2.testselect.options[4].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_4',0); ?>";}
else if (testInteger=document.testform2.testselect.options[5].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_5',0); ?>";}
else if (testInteger=document.testform2.testselect.options[6].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_6',0); ?>";}
else if (testInteger=document.testform2.testselect.options[7].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_7',0); ?>";}
else if (testInteger=document.testform2.testselect.options[8].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_8',0); ?>";}
else if (testInteger=document.testform2.testselect.options[9].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_9',0); ?>";}
else if (testInteger=document.testform2.testselect.options[10].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_10',0); ?>";}
else if (testInteger=document.testform2.testselect.options[11].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_11',0); ?>";}
else if (testInteger=document.testform2.testselect.options[12].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_12',0); ?>";}
else if (testInteger=document.testform2.testselect.options[13].selected) { 
document.testform2.testtext.value = "<?php echo $orders_row->getField('name_product_13',0); ?>";}
}
</script>