form params help

Zac Elston wrote:

I've got a form where I have several items ("packages") listed and I want to query a param that should contain all the "packages" from the form in the controller. However I'm only getting the first item returned.

a working example is HATBM checkboxes where
<input id="package[names][]" name="package[names][]" type="checkbox" value="z1" />
<input id="package_names" name="package[names]" type="text" value="z1" />

how do I get the name="object[method][]

here's the rhtml

<%= start_form_tag :action => 'push' %>
<% @packages.each do |p| %>
<%= hidden_field 'package', 'Name', :value => p.Name %>
<% end %>
  <%= submit_tag "PushIT" %>
<%= end_form_tag %>

my controller (just a skeleton at the moment to debug

def push

@params = params
  @pkgparams = params[:package][:Name]


my result is only the first package from the |p| loop.

How do I get multiple text fields to collect into a param with the same name like a checkbox does?

<% @packages.each do |p| %>
<%= text_field_tag 'package_names[]', %>
<% end %>

params[:package_names] will be an array of strings
when the form is posted.