Re: array of radio buttons
| From: | Morgan Grubb | Date: | Wed, 26 Jun 2002 02:49:38 +0000 |
| Subject: | Re: array of radio buttons | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103891@lists.php.net to get a copy of this message | ||
The whole idea with radio buttons is that they represent only one option.
It's possible to have more than one selected, but only if they are
independent.
So having:
> echo "<input type=radio name=payment_type[] value='MBF'
> SELECT>MBF\n";
> echo "<input type=radio name=payment_type[] value='TON'>TON\n";
will result in $payment_type having either 'MBF' or 'TON' but not both and
certainly not more than one despite $payment_type being an array.
--
Cheers,
Morgan Grubb.
"Jeff D. Hamann" <jeff_hamann@hamanndonald.com> wrote in message
news:20020625235743.35512.qmail@pb1.pair.com...
> I have a form that I would like to pass to a php script that contains a
> "grid" of text fields using the array syntax like:
>
> printf( "<TD align='right'>" );
> printf( "<INPUT type='text' name='stick_price[]' size=5
> value='$row[stick_price]' >" );
> printf( "</TD>" );
>
> printf( "<TD align='right'>" );
> printf( "<INPUT type='text' name='weight_price[]' size=5
> value='$row[weight_price]' >" );
> printf( "</TD>" );
>
> I would also like to have a radio button for each row and cannot figure
out
> how to pass an array of radio buttons (as I can with check boxes) as the
> radio group needs to have a unique nae for each row. It doesn't appear
that
> the following works:
>
> printf( "<TD align='right'>" );
> echo "<input type=radio name=payment_type[] value='MBF'
> SELECT>MBF\n";
> echo "<input type=radio name=payment_type[] value='TON'>TON\n";
> printf( "</TD>" );
>
> I'm about to give up and just use a checkbox ( as I have code to pull out
a
> list of check boxes) but I would have to generate some code to ensure that
> only one check box is selected. ugh.
>
> Any suggestions?
> Jeff.
>
>
> --
> Jeff D. Hamann
> Hamann, Donald & Associates, Inc.
> PO Box 1421
> Corvallis, Oregon USA 97339-1421
> Bus. 541-753-7333
> Cell. 541-740-5988
> jeff_hamann@hamanndonald.com
> www.hamanndonald.com
>
>
>