I have a method to put states into a select statement as follows:

kNAStates is defined as follows: "AB - Alberta";"AK - Alaska";...

<%get global array("kNAStates";$States)%>
<SELECT NAME="State">
<OPTION VALUE="" SELECTED>-Pick a State/Province- </OPTION>
<%for($i;1;size of array($States))%>
<OPTION VALUE=<%=substring($States{$i};1;2)%>><%=$States{$i}%</OPTION>
<%end for%>
</SELECT>

HTML output from this looks as follows:

<SELECT NAME="OtherState">
<OPTION VALUE="" SELECTED>-Pick aState/Province- </OPTION>
                                
<OPTION VALUE=AB>AB - Alberta</OPTION>
                                
<OPTION VALUE=AK>AK - Alaska</OPTION>...

The extra lines in the HTML have 5 tabs followed by a carriage return. Is there a better way to do this to eliminate the extra space? Or do I just live with this?

<%for($i;1;size of array($States))%><stuff in here><%end for%>

Nothing requires the "for" and "end for" to be on separate lines if they are in separate code blocks. Same with all other control structures.

Regards,

   Aparajita
   Victory-Heart Productions
   [EMAIL PROTECTED]
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoylibrary.com




Reply via email to