Re: Stupid PHP - database question ...

by Kathy Wheeler <kathyw(at)home.albury.net.au>

 Date:  Thu, 27 Nov 2003 06:55:49 +1100
 To:  "Davies,
Elizabeth H." <EHDavies(at)West.com>,
<hwg-techniques(at)hwg.org>
 References:  westworlds
  todo: View Thread, Original
Insert: haven't-used-Informix-but-principles-should-b-similar ;-)

On Thursday 27 November 2003 04:13, Davies, Elizabeth H. wrote:
> Entry page I list out all the trainees enrolled and give a radio button
> choice to pick the new status (complete,incomplete,absent).

You say "radio" here and the code has "checkbox". Unless they can have more 
than one status at a time ... radio would be better. Personally I'd use a 
select box.

> What I can't figure out is how to loop through the resultant info and
> connect it to the proper trainee ie) how to build the update query... 1.
> should I have a different way of naming the radio buttons?

I gather $id is the trainee's unique id, a key field in your database? And you 
may want to update more than one trainee's status at a time? Simply split() 
on the "_" and grab the 2nd field (actually there's probably lots of ways of 
doing it but that's the first one to come to mind at 6:30 in the morning ;-) 
Then insert the value of the (unsplit) status variable name into that 
trainee's $id at the appropriate spot. Loop through for the rest.

> 2. what the heck do I do on the other end to update the training_transcript
> table?

Redraw the page based on the updated database??

Cheers,
KathyW.

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA