Problem with textboxes and javascript array

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]