yep, that's very useful, thank you. I haven't entirely come out of PHP
mindset yet, in which arrays are the natural scheme of things (PHP list
functions are either non-existent or largely suck IMHE). I had real problems
a while ago with trying to use $variable[$i] in a loop, and it scared me
somewhat...
so, of course, if I do
<cfloop index="i" from="1" to="something">
...
fieldname#1#
...
</cfloop>
I can then do,
cfloop index="i" from="1" to="#Form.Performances#">
<cfquery>
INSERT
INTO performancesTable (fieldname...)
VALUES ('form.fieldname#i#' and so on)
</cfquery>
</cfloop>
bit of a nightmare, really: my immediate project (which I should be doing
now, except I'm rather having fun messing about with CF) is to finish
www.realfoodonline.com (I say 'finish', but it's everything bar the book
section ;-) in PHP, then hopefully end of Feb I rebuild from scratch
www.artsoutheast.co.uk in CF. Which seems to be a recipe for ongoing
confusion (or ColdFusion, even ;-)
BTW, one of the things I really like about PHP/MySQL is the ability to
manage the db through a GUI (PHPMyAdmin). Is there an equivalent way of
managing an Access db through a GUI? Of course I can modify the db through
SQL statements, but that ain't the same as actually being able to see the
whole db on the screen before you... I'm hosting with Loud-n-Clear, who I
must say are excellent...
Ian W
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 4:04 PM
Subject: Re: [ cf-dev ] checked radio boxes in a loop...
>
> also if you're submitting form fields with the same name, they don't get
> put into an array; they get put into a list, eg as the code currently is,
> you might have something like:
>
> signed: yes, no, yes, no, yes, yes, no, no
>
> if you give each field a unique name based on your loop counter i, you'd
> instead have:
> signed1: yes
> signed2: no
> etc.
>
> could then loop through based on the form.performances field.
>
> <cfloop index="i" from="1" to="#Form.Performances#">
> <cfquery>
> INSERT
> INTO performancesTable (field1, field2, field3, signed)
> VALUES ('#form.field1#', '#form.field2#', '#form.field3#', '
> #form.signed##i#')
> </cfquery>
> </cfloop>
>
>
> Duncan Cumming
> IT Manager
>
> http://www.alienationdesign.co.uk
> mailto:[EMAIL PROTECTED]
> Tel: 0141 575 9700
> Fax: 0141 575 9600
>
> Creative solutions in a technical world
>
> ----------------------------------------------------------------------
> Get your domain names online from:
> http://www.alienationdomains.co.uk
> Reseller options available!
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
>
>
>
> "Ian
> Westbrook" To: "cfug dev list"
<[EMAIL PROTECTED]>
> <ian@futuredr cc:
> eam.net> Subject: [ cf-dev ] checked
radio boxes in a loop...
>
> 01/07/03
> 03:49 PM
> Please
> respond to
> dev
>
>
>
>
>
> Hi.
> I'm experimenting with loops: you can take a look at the experiment at
> http://www.artsoutheast.co.uk/diarytest.cfm
>
> if you choose more than '1' for the number of performances, you'll notice
> that only the last set of radio boxes are checked (the 'no' option should
> be checked for each)...
>
> the code's a bit long, but the relevant bit is:
>
> <cfloop...>
> ...
>
> Is this performance audio-decribed? Yes: <input type="radio" name="audio"
> value="yes"> No: <input type="radio" name="audio" value="no" checked>
>
> <br><br>
>
> Is this performance signed? Yes: <input type="radio" name="signed" value
> ="yes"> No: <input type="radio" name="signed" value="no" checked>
>
> ...
>
> </cfloop>
>
> any way of getting them all to come out as checked?
>
> also, when I submit these performance records, they're going to be turned
> into an array, no? (don't bother submitting the form - haven't done that
> bit yet ;-) anyone any ideas how I iterate through the array to write each
> performence record to a db table? full code below, for anyone that's
> interested...
>
> TIA, any ideas welcome.
>
> Ian W
>
>
>
> <cfset todaydate = Now()>
> <cfset testday = Day(todaydate)>
> <cfset testmonth = Month(todaydate)>
>
>
> <html>
> <head>
> <title>Untitled</title>
> </head>
>
> <body>
>
>
> <cfif IsDefined("form.perfnumber")>
>
> <cfoutput>
>
> <form action="#cgi.SCRIPT_NAME#" method="post">
>
> <cfloop from="1" to="#form.perfnumber#" index="i">
>
> Performance: <b>#i#</b> <br><br>
>
> Date:
>
> <select>
> <option value="null">month</option>
> <cfloop from="1" to="12" index="m">
> <option value="#m#" <cfif m IS #variables.testmonth#>selected</cfif>>
> #monthasstring(m)#</option>
> </cfloop>
> </select>
>
> <select>
> <option value="null">day</option>
> <cfloop from="1" to="31" index="d">
> <option value="#d#" <cfif d IS #variables.testday#>selected</cfif>>
> #d#</option>
> </cfloop>
> </select>
>
> <select>
> <option value="null">year</option>
> <cfloop from="2003" to="2005" index="y">
> <option value="#y#" <cfif y IS '2003'>selected</cfif>>#y#</option>
> </cfloop>
> </select>
>
> <br><br>
>
> Ticket price:
>
> <select>
> <option value="null">pounds</option>
> <cfloop from="1" to="30" index="p">
> <option value="#p#">#p#</option>
> </cfloop>
> </select>
>
> <select>
> <option value="null">pence</option>
> <cfloop from="01" to="99" index="c">
> <option value="#c#">#c#</option>
> </cfloop>
> </select>
>
> <br><br>
>
> Concessions:
>
> <select>
> <option value="null">pounds</option>
> <cfloop from="1" to="50" index="p">
> <option value="#p#">#p#</option>
> </cfloop>
> </select>
>
> <select>
> <option value="null">pence</option>
> <cfloop from="01" to="99" index="c">
> <option value="#c#">#c#</option>
> </cfloop>
> </select>
>
> <br><br>
>
> Time:
>
> <select>
> <option value="null">hour</option>
> <cfloop from="1" to="24" index="hh">
> <option value="#hh#">#hh#</option>
> </cfloop>
> </select>
>
> <select>
> <option value="null">minutes</option>
> <cfloop from="1" to="60" index="mm">
> <option value="#mm#">#mm#</option>
> </cfloop>
> </select>
>
> <br><br>
>
> Is this performance audio-decribed? Yes: <input type="radio" name="audio"
> value="yes"> No: <input type="radio" name="audio" value="no" checked>
>
> <br><br>
>
> Is this performance signed? Yes: <input type="radio" name="signed" value
> ="yes"> No: <input type="radio" name="signed" value="no" checked>
>
> <br><br><br><br>
>
> </cfloop>
>
>
> <input type="hidden" name="performances" value="#form.perfnumber#">
>
> <input type="submit" value="submit">
>
> </form>
>
> </cfoutput>
>
>
>
>
>
> <cfelse>
>
>
> <form action="#cgi.SCRIPT_NAME#" method="post">
>
> Number of performances: <br>
>
> <select name="perfnumber">
>
> <cfloop from="1" to="20" index="m">
> <cfoutput>
> <option value="#m#">#m#</option>
> </cfoutput>
> </cfloop>
>
> </select>
>
> <br>
>
> <input type="submit" value="submit">
>
>
> </form>
>
> </cfif>
>
> </body>
> </html>
>
>
>
>
>
> Ian Westbrook,
> FutureDream Media Limited,
> (W): www.futuredream.net
> (E): [EMAIL PROTECTED]
> (T): +44 (0) 1303 258 985
> (M): 07939 510 812
>
> This message may contain information which is legally privileged and/or
> confidential. If you are not the intended recipient, you are hereby
> notified that any unauthorised disclosure, copying, distribution or use of
> this information is strictly prohibited. Such notification notwithstanding
> any comments, opinions, information or conclusions expressed in this
> message are those of the originator, not of FutureDream Media Ltd, unless
> otherwise explicitly and independently indicated by an authorised
> representative of FutureDream Media Ltd.
>
>
>
>
>
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
>
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]