Connecting Tech Pros Worldwide Forums | Help | Site Map

how to create list of people with Yes/No radio buttons for each, then process form

NotGiven
Guest
 
Posts: n/a
#1: Dec 19 '05
I have a database result set with names, IDfield and a Y/N field.

How do I create the radio buttons that can then be processed easily using an
array (I assume) with an easy-to-loop-through structure?

The form would look like:

Joe Smith O[Y] O[N]
Karen Smith O[Y] O[N]
....

Any ideas are appreciated!



larry@portcommodore.com
Guest
 
Posts: n/a
#2: Dec 20 '05

re: how to create list of people with Yes/No radio buttons for each, then process form


That's more code than I want to write here also your form structure
would probably differ from mine, but I can say you got the general idea
there. Here is a general idea of how the code goes:

General structure would be
read in the data...
- set counter to 0
- select the records
- loop through the record with mysql_fetch_array
- - increment counter
- - Read in record ID, Name and Yes/No response to thier respective
arrays (i.e. $name[] = $items['name']; $recordid =
$items['recordid'];)

Display the HTML, (inside use a PHP script to create the inputs)
- Using a loop read in the array values as inputs up to the counter
- - for input names use the array ID (i.e. ..name="name[]"> )
- (don't forget to include the array counter and the record ID array
as 'hidden' values.)
- submit

Reading back in the submitted form
- read through arrays
- - Do SQL updates with array data

Hope that helps!

Larry

NotGiven
Guest
 
Posts: n/a
#3: Dec 21 '05

re: how to create list of people with Yes/No radio buttons for each, then process form


many thanks!


<larry@portcommodore.com> wrote in message
news:1135048720.160910.91840@g49g2000cwa.googlegro ups.com...[color=blue]
> That's more code than I want to write here also your form structure
> would probably differ from mine, but I can say you got the general idea
> there. Here is a general idea of how the code goes:
>
> General structure would be
> read in the data...
> - set counter to 0
> - select the records
> - loop through the record with mysql_fetch_array
> - - increment counter
> - - Read in record ID, Name and Yes/No response to thier respective
> arrays (i.e. $name[] = $items['name']; $recordid =
> $items['recordid'];)
>
> Display the HTML, (inside use a PHP script to create the inputs)
> - Using a loop read in the array values as inputs up to the counter
> - - for input names use the array ID (i.e. ..name="name[]"> )
> - (don't forget to include the array counter and the record ID array
> as 'hidden' values.)
> - submit
>
> Reading back in the submitted form
> - read through arrays
> - - Do SQL updates with array data
>
> Hope that helps!
>
> Larry
>[/color]


Closed Thread