Results 1 to 7 of 7

Thread: HTML Select Problem

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    HTML Select Problem

    Hey All

    I hope a explain the clearly enough.

    I have 2 fields from 1 table:
    EmployeeID
    Employee_Name

    I load the ASP page and it fills a Select\DropDown list with the EmployeeName's from the database.

    The user selects the name they wish from the list, changes some other details and submits the form.

    Now how do i convert the employee name back to the correct Employee_ID??

    Especially if their are 2 emplyee's with the same name?

    cheers
    b

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    You'll have a

    <SELECT>
    <OPTION Value="his_employee_id">his_employee_name</option>
    ....
    </SELECT>



    You can work with the value, no?

  3. #3
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi Beacon,
    Good to see you here, i thougt you left VBF.

    Anyhow the most efficient way to use The ID field as its the primary key. Simply set the Value property to the EmployeeID and display Employe Name.

    E.g
    VB Code:
    1. <select name="Emp_List">
    2. <%
    3. do while not rs.eof
    4. response.write "<option value=" & rs("EmployeeID") & ">" & rs("EmployeeName") & "</option>"
    5.  
    6. rs.movenext
    7. loop
    8. %>
    9. </select>
    Now when you submit the form the EmployeeID field will be submited, now you can easily identify the rows uniquley.

    e.g
    VB Code:
    1. dim EmpId
    2. dim sql
    3.  
    4. EmpID=request.form("Emp_List")
    5.  
    6. sql="Update Employe set Emp_Location='London' Where EmployeeId=" & EmpId
    7.  
    8. conn.execute (sql)
    Hope this helps.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by mendhak
    You'll have a

    <SELECT>
    <OPTION Value="his_employee_id">his_employee_name</option>
    ....
    </SELECT>



    You can work with the value, no?
    Got there before me, Damm i type too slow . May be i should do more one liner
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    And that ain't even the reason why they call me the fastest fingers in the west

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by mendhak
    And that ain't even the reason why they call me the fastest fingers in the west
    Lol, yes i heard the rumours that alien frog do have fast and long fiengers
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #7

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    G'day boys

    How's things?

    excellent...why didnt i think of that before hand.
    thanks the both of you.

    Yeah i left VBF for GalahTech and then for Neowin. But Neowin has know Porgramming section and GT had no users.

    With my new job it's hard to browse forums for more than 10min.

    But if you put up a petition in Chit Chat i could submit it too my boss.

    cheers
    b

Posting Permissions

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



Click Here to Expand Forum to Full Width