Closed Thread
Results 1 to 5 of 5

Thread: Two questions regarding <select> data manipulation

  1. #1
    Joeyeti is offline Newbie
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    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. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,480
    Blog Entries
    75
    Rep Power
    143

    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 09:20 AM. Reason: formatting
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    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

  5. #4
    Joeyeti is offline Newbie
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    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...

  6. #5
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    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

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to select data of a select list from database table
    By justsachin4u in forum PHP Development
    Replies: 26
    Last Post: 07-10-2011, 12:34 AM
  2. How to Select data of a select list from database???
    By justsachin4u in forum PHP Development
    Replies: 0
    Last Post: 06-25-2011, 04:58 AM
  3. How to Select data of a select list from database???
    By justsachin4u in forum PHP Development
    Replies: 0
    Last Post: 06-25-2011, 04:49 AM
  4. Unable to select data from database
    By thatsme in forum PHP Development
    Replies: 8
    Last Post: 06-24-2011, 10:27 AM
  5. To select data randomly from database
    By Divya in forum Database & Database Programming
    Replies: 1
    Last Post: 03-28-2009, 05:07 AM

Tags for this Thread

Bookmarks

Posting Permissions

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