+ Reply to Thread
Results 1 to 5 of 5

Thread: Two questions regarding <select> data manipulation

  1. #1
    Newbie Joeyeti is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    4

    Two questions regarding <select> data manipulation

    Hi all programmers,

    I am creating a simple webpage with an image in the background and multiple comboboxes (<select> tag) for the user to select values. Here is one of the comboboxes:

    Code:
    <select style="position:absolute; left:919px; top:288px; background-color: blue; color: white;" id="cze us" class="us">
    <option selected>0 <option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11
    </select>
    I need to work with these selected values further and as I am quite a noob in HTML/Web programming, I have these questions:


    1. How could I add values in multiple comboboxes selected, e.g. 1,3,2,6,0 together to a sum value with a button click?

    2. Or would it be possible to make the addition interactive - e.g. once the user selects a different value in a combobox, the sum would be adjusted?

    3. How could I store the current selections in multiple comboboxes in a txt file on the server and then recall it later?

    Thx!

    Joe

  2. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: Two questions regarding <select> data manipulation

    Your code should really look more like this:
    Code:
    <select style="position:absolute; left:919px; top:288px; background-color: blue; color: white;" id="cze us" class="us">
      <option selected value="0">0</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7">7</option>
      <option value="8">8</option>
      <option value="9">9</option>
      <option value="10">10</option>
      <option value="11">11</option>
    </select>
    Most of what you are talking about requires either JavaScript or server-side scripting.
    Last edited by WingedPanther; 11-21-2008 at 11:20 AM. Reason: formatting
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  3. #3
    Xav
    Xav is offline
    Code Slinger Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav's Avatar
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,210
    Blog Entries
    13

    Re: Two questions regarding <select> data manipulation

    If you can use PHP then you could automate the process of generating options:

    Code:
    <select style="position:absolute; left:919px; top:288px; background-color: blue; color: white;" id="cze us" class="us">
    <?php
    for ($i 0$i <= 11$i++)
    {
      echo 
    "<option selected value=\"$i\">$i</option>";

    }
    ?>
    </select>

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  4. #4
    Newbie Joeyeti is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    4

    Re: Two questions regarding <select> data manipulation

    Thx guys,

    could this then perhaps be moved to the PHP section to fit?
    I would be interested in a PHP solution for the addition of the dropdown boxes...

  5. #5
    Xav
    Xav is offline
    Code Slinger Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav's Avatar
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,210
    Blog Entries
    13

    Re: Two questions regarding <select> data manipulation

    If you want the items to be added without reloading the page, then you need to use JavaScript.

    My code above was just to add the items when the user opens the page.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. C#:Tutorial - Download Data
    By Xav in forum CSharp Tutorials
    Replies: 13
    Last Post: 02-11-2010, 02:17 PM
  2. Choosing the right language / data structure / Interface
    By ups in forum General Programming
    Replies: 1
    Last Post: 09-20-2008, 09:11 AM
  3. Java:Tutorial - Data Types
    By John in forum Java Tutorials
    Replies: 6
    Last Post: 07-02-2007, 09:16 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts