# Problem with textboxes and javascript array

**URL:** <https://forum.kirupa.com/t/problem-with-textboxes-and-javascript-array/316403>\
**Category:** web dev\
**Created:** [November 20, 2010, 10:28am UTC](https://forum.kirupa.com/t/problem-with-textboxes-and-javascript-array/316403 "2010-11-20T10:28:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simbad](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@simbad](https://forum.kirupa.com/u/simbad)\
**Post date:** [November 20, 2010, 10:28am UTC](https://forum.kirupa.com/t/problem-with-textboxes-and-javascript-array/316403/1 "2010-11-20T10:28:27Z")

</div>

Hello am getting a big problem with the following codes.

while([COLOR=green]$fetch=mysql\_fetch\_array($result)[/COLOR])  
{  
\<form name=“myform”\>  
//looping fetching data from php  
and putting them in a hidden box

\<input type=“hidden” name=“p[]“value=”[COLOR=red]\<?php[/COLOR] echo $fetech[‘id’];[COLOR=red]?\>[/COLOR]”\>  
//everything it works

\<input type=“button” name=“send” onclick=“doing();”\>  
\</form\>  
}

here comes the trouble i dnt know how to make it works to send the  
value to the other textbox.

[COLOR=darkorchid]\<script language=“javascript”\>[/COLOR]  
function doing(){  
var b= document.getElementsByName(“p[]”);

//sending the value to a textbox  
//it works only if the “i” is being inputed manually  
//example b[0],b[1]  
[COLOR=blue]//what to do to get the it then one click on the button send[/COLOR]

document.getElementById(“al”).value=b\*.value;  
[COLOR=blue]//the textbox id is “al”[/COLOR]  
}  
[COLOR=darkorchid]\</script\>[/COLOR]
