|
Posted by Rory Browne on 05/28/05 00:48
or
foreach(range('A', 'Z') as $letter){
echo "<option value='$letter'>$letter</option>"
}
www.php.net/range
On 5/27/05, Rory Browne <rory.browne@gmail.com> wrote:
> I didn't see the OP, but:
>
> for($i = 'A'; $i != 'Z'; $i = chr(ord($i) +1)){
> echo "\t<option value=\"$i\">$i</option>\n";
> }
>
>
> On 5/26/05, Stephen Johnson <php@thelonecoder.com> wrote:
> > Then this is what I would suggest.
> >
> > $alph = array('*', 'A', 'B','C'...etc) ;
> >
> > $i=0;
> > Echo"<Select name=foo>";
> > While($alph[$i]){
> > echo"<option value=$alph[$i]>$alph[$i]";
> > $i++;
> > }
> > Echo"</Select>";
> >
> > On 5/25/05 9:54 PM, "MIGUEL ANTONIO GUIRAO AGUILAR"
> > <miguel.guirao@mail.telcel.com> wrote:
> >
> > > Yes, because I will create a <select> field within the for loop, and the
> > > options of the select should be letters.
> > >
> > > --------------------------
> > > MIGUEL GUIRAO AGUILERA
> > > Logistica R8 - Telcel
> > > Tel: (999) 960.7994
> > > Cel: 9931-60000
> > >
> > > ----- Mensaje original -----
> > > De: Stephen Johnson <php@thelonecoder.com>
> > > Fecha: Miércoles, Mayo 25, 2005 9:49 pm
> > > Asunto: Re: [PHP-DB] Letters loop
> > >
> > >>
> > >> Why?
> > >>
> > >> If you need to do a loop that runs 26 times just set your high
> > >> value for 26.
> > >>
> > >> Is there some reason you need to use letters ?
> > >>
> > >>
> > >>
> > >> On 5/25/05 8:37 PM, "MIGUEL ANTONIO GUIRAO AGUILAR"
> > >> <miguel.guirao@mail.telcel.com> wrote:
> > >>
> > >>> Hi!!
> > >>>
> > >>> I wanna a do a for loop with letters, Is this possible?
> > >>>
> > >>> for ($i = 'A'; $i <= 'Z'; $i++){
> > >>> // code
> > >>> }
> > >>>
> > >>> --------------------------
> > >>> MIGUEL GUIRAO AGUILERA
> > >>> Logistica R8 - Telcel
> > >>> Tel: (999) 960.7994
> > >>> Cel: 9931-60000
> > >>
> > >> --
> > >> Stephen Johnson
> > >> The Lone Coder
> > >>
> > >> stephen@thelonecoder.com
> > >> http://www.thelonecoder.com
> > >>
> > >> *Continuing the struggle against bad code*
> > >> --
> > >>
> > >>
> > >>
> > >
> > >
> >
> > --
> > Stephen Johnson
> > The Lone Coder
> >
> > stephen@thelonecoder.com
> > http://www.thelonecoder.com
> >
> > *Continuing the struggle against bad code*
> > --
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
Navigation:
[Reply to this message]
|