RE: [PHP] array of radio buttons
| From: | Martin Towell | Date: | Tue, 25 Jun 2002 23:59:47 +0000 |
| Subject: | RE: [PHP] array of radio buttons | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-103857@lists.php.net to get a copy of this message | ||
If you must have an array of radio buttons, what about the following?
printf( "<TD align='right'>" );
echo "<input type=radio name=payment_type[0] value='MBF'
SELECT>MBF\n";
echo "<input type=radio name=payment_type[0] value='TON'>TON\n";
printf( "</TD>" );
printf( "<TD align='right'>" );
echo "<input type=radio name=payment_type[1] value='MBF'
SELECT>MBF\n";
echo "<input type=radio name=payment_type[1] value='TON'>TON\n";
printf( "</TD>" );
It's a bit dodgy, but hey - it should work
-----Original Message-----
From: Jeff D. Hamann [mailto:jeff_hamann@hamanndonald.com]
Sent: Wednesday, June 26, 2002 9:59 AM
To: php-general@lists.php.net
Subject: [PHP] array of radio buttons
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:
[snip "text" example]
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.