Dynamically Populating Drop Down Lists

Hi,
I am trying to dynamically populate a drop down list on a form based on a selection in another drop down list. I have read the help file "To dynamically populate a second field after populating the first" which goes through an example, however I cannot get this example to work for me.
I know that the best way to do it is to create an xml file and connect the form to this file. I am new to programming in xml but have had some experience in other forms. The code that I have (from the help page) looks like this;
<?xml version="1.0" encoding="UTF-8"?>
<MyData>
   <country/>
   <countries>
      <item uiname="United States" token="US"/>
      <item uiname="Vietnam" token="SRV"/>
   </countries>
   <state/>
   <US>
      <item>California</item>
      <item>New York</item>
      <item>Texas</item>
   </US>
   <SRV>
      <item>An Giang</item>
      <item>Bac Giang</item>
      <item>Bac Kan</item>
   </SRV>
</MyData>
I have then followed the instructions on the page, and am unable to populate either field on my form. Perhaps there is something wrong with my code? Or any other suggestions would be greatly appreciated! 
Thanks

Hi Paul,
I have another question,
I would now like to populate a third drop down menu based on the selection in the second one, however my code is going wrong somewhere as now when I put in the first 2 drop down lists, nothing appears in the second one. ie, the first drop down list I link to countries, and the second to state, as I did with the previous file, but now, when I preview it, I can choose a country, but nothing comes up in state. When I set the first drop down box to countries, I have to specify that I want it to show the uiname, but I can't do that with the second one when I select state using the XML file below, nothing is shown. Where am I going wrong?
<MyData>
   <Country/>
   <countries>
      <item uiname="United States" token="US"/>
      <item uiname="Vietnam" token="SRV"/>
   </countries>  
   <state/>
   <US>
      <item uiname="California" token="CA"/>     
      <item uiname="New York" token="NY"/>   
      <item uiname="Texas" token="TEX"/>
   </US>
   <SRV>
      <item uiname="An Giang" token="AG"/>
      <item uiname="Ban Giang" token="BG"/>
      <item uiname="Bac Kan" token="BK"/>
   </SRV>
   <time/>
   <CA>
      <item>6</item>
      <item>7</item>
   </CA>
   <NY>
      <item>5</item>
      <item>4</item>
   </NY>
   <TEX>
      <item>3</item>
      <item>8</item>
   </TEX>
   <AG>
      <item>2</item>
   </AG>
   <BG>
      <item>1</item>
   </BG>
   <BK>
      <item>9</item>
   </BK>
</MyData>
Thank you for your help!

Similar Messages

  • Self populating drop down lists.

    Is there any tutorials or information to do a self populating
    drop down list
    in CF?
    I assume you would have the form post back to its self using
    a IsDefined for
    each drop down step. Drop Down 1 (DD1) is selected and that
    posts back to
    the same page and causes the DD2 to run a SQL query based on
    DD1's choice
    and you repeat the process until the final DD is selected.
    Is this correct and where can I find a good tutorial?
    Thanks
    Wally Kolcz
    Developer / Support

    Do a search on Google for "related selects in ColdFusion".
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technologies, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "Wally Kolcz" <[email protected]> wrote in
    message
    news:e7c9hc$g6a$[email protected]..
    > Is there any tutorials or information to do a self
    populating drop down
    > list in CF?
    >
    > I assume you would have the form post back to its self
    using a IsDefined
    > for each drop down step. Drop Down 1 (DD1) is selected
    and that posts back
    > to the same page and causes the DD2 to run a SQL query
    based on DD1's
    > choice and you repeat the process until the final DD is
    selected.
    >
    > Is this correct and where can I find a good tutorial?
    >
    > Thanks
    >
    > --
    > Wally Kolcz
    > Developer / Support
    >

  • Populating drop down lists dynamically???

    I have a date field on my jsp form. I want to ensure that the date is entered correctly.
    To do this I have 3 drop down lists....year, month, date.
    How can I populate the date list when the user selects a month?
    e.g. user enters "Feb". Date list should only display numbers 1 to 28 or 1 to 29 if it is a leap year.
    Any idea's or suggestions???

    Can anyone help???
    I have a date field on my jsp form. I want to ensure
    that the date is entered correctly.
    To do this I have 3 drop down lists....year, month,
    date.
    How can I populate the date list when the user selects
    a month?
    e.g. user enters "Feb". Date list should only display
    numbers 1 to 28 or 1 to 29 if it is a leap year.
    Any idea's or suggestions???

  • Populating Drop-down List in Interactive Forms for Java

    Hi,all
    I need to populate a drop-down list in Interactive Form.
    I tried to do it by using Dynamic Properties of the drop-down
    list,but didn't give nothing.At the same time I have successfully
    populated a simple drop-down list(on webdynpro view),which I
    replaced near my InteractiveForm.
    What may be the problem?
    Regards,
    Michael

    Use the DDL from the Web Dynpro pallette. Bind the same/ similar attribute of the DDL you used in the web Dynpro view in the interactive form also... this should work..
    Thanks and Regards,
    Anto.

  • JSF & IFrames to dynamically load drop down lists

    I have a drop down list (DDL) whose content is dependant on another DDL. I have implemented this fine using JSF using the following jsp:
          <h:outputLabel for="selectRegion">
            <h:outputText value="Region"/>
          </h:outputLabel>
          <h:selectOneMenu id="selectRegion" validator="#{LocationBean.validateDDL}" value="#{LocationBean.region}" valueChangeListener="#{LocationBean.changeRegion}" onchange="submit();">
            <f:selectItems value="#{LocationBean.regions}"/>
          </h:selectOneMenu>
          <f:verbatim>
            <iframe id="regionFrame" name="regionFrame" style="width:0px;height:0px;border:0px"></iframe>
          </f:verbatim>
          <h:message for="selectRegion"/>
          <h:outputLabel for="selectDistrict">
            <h:outputText value="District"/>
          </h:outputLabel>
          <h:selectOneMenu id="selectDistrict" validator="#{LocationBean.validateDDL}" value="#{LocationBean.district}" onchange="submit();">
            <f:selectItems value="#{LocationBean.districts}"/>
          </h:selectOneMenu>
          <h:message for="selectDistrict"/>When selecting a region, the onChange="submit();" resubmits the entire page and the valueChangeListener="#{LocationBean.changeRegion}" is triggered which updates the district DDL.'s options.
    Resubmitting and retrieving the entire page contents is an expensive task, so I would like to use iframes/javascript to dynamically reload the second DDL without reloading everything else.
    Can this be done in conjunction with the JSF framework, or does JSF require a full page submit and retrieval in order to go through the JSF lifecycle?

    Any ideas?
    I've got a bad feeling the problem is that a hidden iframe being populated using a get method such as
    "directorate.jsp?directorateId=1" won't work because JSF doesn't support the html get method.
    Any other ways of reloading just a single portion of the page anyone knows about?
    Thanks

  • Error while populating drop down list with values from a database

    Hi all,
    I have a JSP page with a drop down list that is to be populated with values from a database.
    This is the code in my JSP file:
         <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) { %>
                       <option value="<%=iterator.next().intValue()%>"> <%=iterator.next().intValue()%> </option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>   The DataManager.java class simply forwards this to its respective Peer class, which has the code shown below:
          package seatplanner.model;
        import java.sql.Connection;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import java.util.ArrayList;
        /* This class handles all floor operations */
         public class FloorPeer
         /* This method returns all the floor numbers */
         public static ArrayList<Integer> getAllFloorNumbers(DataManager dataManager) {
            ArrayList<Integer> floornumbers = new ArrayList<Integer>();
            Connection connection = dataManager.getConnection();
            if (connection != null) {
              try {
                Statement s = connection.createStatement();
                String sql = "select ID from floor order by ID asc";
                try {
                  ResultSet rs = s.executeQuery(sql);
                  try {
                    while (rs.next()) {
                      floornumbers.add(rs.getInt(1));
                  finally { rs.close(); }
                finally {s.close(); }
              catch (SQLException e) {
                System.out.println("Could not get floor numbers: " + e.getMessage());
              finally {
                dataManager.putConnection(connection);
            return floornumbers;
         }  The classes compile properly, but when I load this page up in Tomcat it just freezes and does not load the form. I tested the DB connection and it works fine.
    What am I doing wrong in the JSP code?
    Thanks for the help in advance.
    UPDATE: I commented out the form, and added <%=floornumbers.size()%> right above the commented code to check if the ArrayList is indeed getting populated with the values from the database (the values are of type integer in the database). The page still freezes like before. I'm puzzled now :confused: .

    Wrong usage of Iterator.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) {
                                    Integer inte = iterator.next();
                            %>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>or make use of enhanced loop as you are already using J2SE 5.0+ for avoiding confusions.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% for(Integer inte:floornumbers) {%>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <%}%>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>and a lot better thing would be making usage of basic Taglib provided with JSTL spec or struts spec which make life easier and simple.
    something like usage of <c:forEach/> or <logic:iterate/> would be lot better without writing a single scriptlet code.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Problems with populating Drop Down List (WD ABAP)

    Hi,
    I am trying to populate two Drop Down fields CARRID and CONNID (Type Table SPFLI) on an Adobe Interactive Form in a Web Dynpro ABAP Application.
    In the WD Context I have a node "Flights" with those attributes.
    In the WDDOINIT I populate the Context elements (just for test purposes with all entries of SPFLI).
    [code]  
    DATA:
         node_flights                        TYPE REF TO if_wd_context_node,
         elem_flights                        TYPE REF TO if_wd_context_element,
         stru_flights                        TYPE wd_this->element_flights,
         it_flights TYPE TABLE OF spfli.
    SELECT carrid connid FROM spfli INTO TABLE it_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
       node_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).
    node_flights->bind_table(
        new_items            = it_flights
        set_initial_elements = ABAP_FALSE
    [/code]
    According to this
    Re: adobe form/reader  error I bound the element values property of the Enumerated Drop Down List to [code]$record.sap-vhlist.CARRID.item[*][/code], whereas <i>Object Text</i> is "Text" and <i>Object Value</i> is "Key".
    Unfortunately the DDLs on the Adobe Form are not populated with the values read from the table. I debugged the application and the values are written to the Context node.
    Do you have any further hints?
    Best regards,
    Robin
    Message was edited by:
            Robin Wennemuth

    Robin:
    Did you get this resolved? Would you please tell me how you got it done?
    Thank you,
    Fred.

  • Dynamic populating Drop down using BI Query

    Hi,
    I have a form which has four drop down lists in it.  I need to populate one drop down using a BI Query dynamically.
    How to do this ?
    Thanks in advance.
    Regards,
    Bir.

    Hi,
    Refer the following link
    /people/mario.herger/blog/2006/05/13/adventures-of-our-times-visual-composer-bi-kit
    http://help.sap.com/saphelp_nw2004s/helpdata/en/21/58feb70e884bc68a474429ac26f448/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/28/f7d2ed35a949778d34e4f27777885c/content.htm
    Regards,
    P.Manivannan

  • Error message when populating drop-down list with mysql DB

    Hi everyone,
    i'm having an error message which gives zero result on google...
    here's the context: i have a drop-down list called "Patient" in the template pages of a livecycle form. The binding is set to Global so that the value is the same on the two pages of the form. I have also linked the items of the list to a mysql database (with DataConnection) by clicking the "Specify Item Values" link on the Binding tab of the element.
    now, when i open my form (or preview) i get this message, in french:
    "Propriété incorrecte de l'opération SET; dataGroup ne possède pas de propriété id."
    which is, in english (personal translation):
    "Incorrect property of the SET operation; dataGroup doesn't have an id property."
    this message appears in a messagebox, the background is empty (standard gray color)
    Then i click "OK" (which is the only button available), and my form appears, the list is populated with the values of my database table, so it actually works...
    As i said, i have zero results on google with this message...
    any idea what it means and how to avoid it?
    Thanks!

    Hi,
    For all things XFA Forms and Databases there is no place better than Stefan Cameron's blog: http://forms.stefcameron.com/.
    Have a look here: http://forms.stefcameron.com/2006/12/18/databases-inserting-updating-and-deleting-records/ and at comment 60.
    Good luck,
    Niall

  • Populating Drop down List in Excel Planning Layout

    HI!
    hopefully somebody can help me.
    I have a simple planing function ( copy function: Version1 => Version2 ), Version2 the target version is a BEx Variable and a parameter of the copy planing function.
    basicly i want to put a drop down list on a Excel Planing Layout to manipulate the BEx Variable (Version 2 - the target version). So that the user can fill the BEx Variable by selecting the version by the dropdown list.
    In BW-BPS is quite simple -but unfortunately i dont know how it works in BW-IP.
    Best Regards
    Mike
    Message was edited by:
            Mike Khatib

    Hello Mike,
    First you create two Drop Down lists (Dimension Version, Read Mode Masterdata table) in your workbook. Now go to the Visual basic editor (alt+F11) and you will find the following code for each Drop Down list:
    Public Sub DROPDOWN_22_LostFocus()
      Dim lComboBoxName As String
      Dim BEx1 As Object
      On Error Resume Next
      lComboBoxName = "DROPDOWN_22"
      Set BEx1 = Application.Run("BExAnalyzer.xla!GetBEx")
      Call BEx1.RaiseComboBoxChange(Parent.Name, lComboBoxName)
    End Sub
    Comment the last line and add a function to output the chosen value to a cell in the workbook
    Public Sub DROPDOWN_22_LostFocus()
      Dim lComboBoxName As String
      Dim BEx1 As Object
      Dim version As String
      'Call Dropdown List
      On Error Resume Next
      lComboBoxName = "DROPDOWN_22"
      Set BEx1 = Application.Run("BExAnalyzer.xla!GetBEx")
      'Call BEx1.RaiseComboBoxChange(Parent.Name, lComboBoxName)
      'get version
      version = DROPDOWN_22.Text
      'output chosen version to a cell in the workbook
      Range("C801").FormulaR1C1 = version
    End Sub
    Now add a command range to your workbook (VAR_VALUE_1,1, <VERSION>). That’s it.
    If you need further information don’t hesitate to ask me!
    Best regards
    Johannes
    PS: Please assign points if this information was helpful

  • Populating drop down list in a table cell-urgent

    Hi all
    I have a problem. I want to populate a dropdown list in a table cell. can anybody tell me the step by step procedure for that.
    I am doing it generally. not using R/3
    I am creating sub node like u have mentioned. I haven't done it using wizard.
    Is there any difference in the way we populate this list?
    My root node is expense. Inside that some value attributes are there. For the drop down list i've created a sub node 'extype'.
    I am getting error.
    it is:
    com.sap.tc.webdynpro.progmodel.context.ContextException: Node(EREmpHomeView.expense.extype): cannot bind or add elements because the node has no valid parent
    Following is the code i've written.
    IPrivateEREmpHomeView.IExtypeElement el;
              IPrivateEREmpHomeView.IExtypeNode nd=wdContext.nodeExpense().nodeExtype();
              el=wdContext.nodeExpense().nodeExtype().createExtypeElement();
              el.setEtype("Travel");
              nd.addElement(el);
    Sill i'm getting the same error
    Hi Nidhideep
    Error has gone with the code that Mr Anil has given. But there is no value in the List. Dropdown list is coming as a blank list.
    Thanks and Regards
    Aparnna
    Message was edited by:
            aparnna prasad

    hi
    Aparna try this code:
    1. Context description at design time:
    Value-Node "myNode", collection type=list, cardinality=0..n, selection=0..n
    and the attribute:
    Value attributes “myValue”, type="String".
    2. The corresponding Java source code example that you create in the wdDoInit method of the controller implementation:
    // The ISimpleTypeModifiable interface enables access to
    //a data type instance that can be modified at runtime:
    ISimpleTypeModifiable myType =
       wdThis.wdGetAPI().getContext.getModifiableTypeOf(“.myNode.myValue”);
    //Sets the label text for this data type.
    myType.setFieldLabel(“New label”)
    //Sets the valid values of this data type. The individual elements are inserted
    //when the put method is called and
    //and the value set is filled with the appropriate
    //key value pair.
    IModifiableSimpleValueSet values =
       getSVService().myType.getModifiableValueSet();
    values.put(“key_1”,”Mister”);
    values.put(“key_2”,”Mistress”);
    values.put(“key_3”,”Miss”);
    Regards
    Nidhideep

  • Issue populating drop-down lists on newly created instances.

    I have a drop-down list on the main page and another ddl on the flowed subform. I have js code that populates the support type ddl when a selection is made on the team ddl. My issue is when I use instanceManager.addInstance(1); The new instance doesn't populate with the selection. How do I get it to populate. most of my code; not the array is at http://pastebin.com/uM0ssT8v

    Can anyone help???
    I have a date field on my jsp form. I want to ensure
    that the date is entered correctly.
    To do this I have 3 drop down lists....year, month,
    date.
    How can I populate the date list when the user selects
    a month?
    e.g. user enters "Feb". Date list should only display
    numbers 1 to 28 or 1 to 29 if it is a leap year.
    Any idea's or suggestions???

  • Populating drop down lists

    Greetings
    I have created a form in Acrobat XI Pro with 3+ text fields which populate a drop down list.  My problem is that when I duplicate the Drop down, which I need to do around 50 times, each selection resets all the drop downs to that choice.
    The Drop down fields have a Javascript action added to call a single Javascript. 
    function popDropdown()
        var myBlocks = [];
            myBlocks.push("Select from Drop down");
        if (this.getField("Block1").value != "")
            myBlocks.push(this.getField("Block1").value);
        if (this.getField("Block2").value != "")
            myBlocks.push(this.getField("Block2").value);
        if (this.getField("Block3").value != "")
            myBlocks.push(this.getField("Block3").value);
        this.getField("select").clearItems();
        this.getField("select").setItems(myBlocks);

    Here is the problem: You are modifying the dropdown configuration every time somebody moves the mouse over one of the dropdowns. Every time you set the data in the dropdown list, it will always reset the selection to the first item.
    I would remove all embedded JavaScripts, and all "On Focus" triggers for the dropdowns and the text fields. Then create a new text field that uses the following script as it's custom calculation script:
    // global calculation script
    // take the information from Block1..Block3 and
    // initialize the dropdown lists
    var aDropdownListData = [];
    aDropdownListData.push("Select from Drop down");
    aDropdownListData.push(this.getField("Block1").value);
    aDropdownListData.push(this.getField("Block2").value);
    aDropdownListData.push(this.getField("Block3").value);
    var lDropdowns = ["select1", "select2", "select3" ];
    for (var i in lDropdowns) {
      // get the currently selected item in the dropdown list
      var f = this.getField(lDropdowns[i]);
      var a = f.currentValueIndices;
      var item = "";
      if (typeof a == "number") {    // A single selection
        item = f.getItemAt(a, false);
      else {     // Multiple selections
        item = f.getItemAt(a[0], false);
      f.setItems(aDropdownListData);
      // select the previously selected item again
      for (var i in aDropdownListData) {
        if (aDropdownListData[i] == item) {
          f.currentValueIndices = [ i ];
    Now set this new field to read-only and hidden. This will take care of modifying the dropdown controls whenever you modify one of the text fields. It will also make sure that whatever setting was selected, will be selected again after this change (unless that value is no longer available).

  • Making a self populating drop down list in a servlet

    Dear all,
    I'm trying to make a self-populating list in my servlet. I've seen lots of ways to do it in php and asp and jsp, but i really want to make it work within my current architecture.
    So in my DAO class I have added this method:
    public ResultSet get_Artist_Names_Only()
    try
    ResultSet r = c.createStatement().executeQuery
    ("SELECT artist_name FROM customers");
    c.close();
    return r;
    catch(Exception e)
    System.out.println("Check artist_names_only method");
    return null;
    and then in my servlet i have put this:
    writer.println("<TABLE align=\"top\">");
    writer.println("<TH colspan =\"1\" width = \"4%\">");
    writer.println("<TH colspan =\"1\" width = \"7%\">");
    writer.println("<form method=POST action=BookingFromScreen>");
    writer.println("<select name=\"userList\" size=\"1\">");
    ResultSet r;
    r = factory.getCustomersDAO().get_Artist_Names_Only();
    while (r.next())
    writer.println("the artists are: ");
    writer.println("<option value="+r.getString("artist_name")+"></option>");
    writer.println("</select></TD></TR>");
    writer.println("<tr><td colspan = \"2\"><h2>Enter Artist Name to be booked: </h2></tr></td>");
    writer.println("</table>");
    this is horrible code and its not very surprising it doesn't work, however i'm burned out from looking at it and can't seem to see the problem, i'd really appreciate your help if you could point out to me how i'm being stoopid.
    Thank you
    Jen

    thank you saish, moving 'the artists are' helps visually, as for the fix, i really needed to store it in an arrayList, resultSets aren't very happy about being manipulated!
    here's the fix:
    writer.println("<select name=\"userList\" size=\"1\">");
    ArrayList a = new ArrayList();
    ResultSet r=null;
    // this is just my way of accessing the database and the correct method with the artist names in it
    r = factory.getCustomersDAO().get_Artist_Names_Only();
    while(r.next())
    // retrieve artist names as String variables
    String artist = r.getString("artist_name");
    // add to ArrayList
    a.add(artist);
    for(int i=0; i<a.size(); i++)
    Object art = a.get(i);
    art = (String)art;
    writer.println("<OPTION VALUE=\"" +art+ "\">" art "</OPTION>");
    writer.println("<tr><td colspan = \"2\"><h2>Enter Artist Name to be booked: </h2></tr></td>");
    writer.println("</SELECT></TD></TR>");
    thanks again, i've got another problem now that i'm just about to post about, how to register when one particular cell in a html table has had its link clicked!
    jenxx

  • How to Pre-select Value in auto drop down list

    Hi,
    I have an automatically populated drop down list, and I'm trying to have it display with a pre-selected value (in the example 5). I didn't know where to start, so I modified the Dreamweaver code for "Set value equal to" from the Dynamic list function.The list displays, but the value defaults to 0. What am I missing?
    <?php
    echo '<select name="firstnumber" id="number">';
    for ($j=0; $j<11; $j+=1)
    echo  "<option value=\"$j\" <?php if (!(strcmp(\"$j\",5))) {echo \"selected=\"selected\"\";} ?>$j</option>\n";
    echo '</select>';
    ?>
    Thanks,
    Tim

    The problem is that you have nested PHP tags inside a PHP block. You can't do that. In fact, it's surprising that the code works at all. Normally, nesting PHP tags inside a PHP code block will trigger a syntax error.
    Also, your code is very difficult to read because of the way you use double quotes all the time. It's best to use single quotes for strings, except when you need to display the value of a variable inside a string. You can also nest double quotes inside a single-quoted string and vice versa, making for code that's much easier to read without all the backslashes.
    This is how I have rewritten your code:
    <select name="firstnumber" id="number">
    <?php
    for ($j=0; $j<11; $j+=1) {
      echo  "<option value='$j'";
      if (!(strcmp($j,5))) {
         echo 'selected="selected"';
      echo ">$j</option>\n";
    ?>
    </select>

Maybe you are looking for

  • SCR means in func spec

    Hi SApers, can u let me know about SCR in functional specs. wat does it mean and wen i am doing func specs ,wat r the  importance to see and check . Thnx in adv. Regards shiva<b></b><b></b>

  • Impossible insert in Detail Group

    Hi to all, I am using JDeveloper 10.1.2 and developing an application using ADF Business Components and JheadStart 10.1.2. I created a Group : - Layout Style     table - View Object Usage     ComptesSystemeView1 and a Detail Group : - Layout Style   

  • Slideshows and Screen sizes

    Next to the normal photo organisation, I also use a seperate iPhoto Library as an image and screen shot sorting, and refernce material filing tool. Screenshots and image downloads are often not that big. Going to Slideshows in iPhoto5, showed any ima

  • Can i instal cc on both my mac and windows laptop?

    can i instal cc on both my mac and windows laptop?

  • Free application for cleaning files on a mac

    Can someone please tell me the name of the free i application for cleaning files on a mac that is highly rated?