Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Edit Selection

  1. #1
    mwm
    mwm is offline
    Regular Coder
    Join Date
    Oct 2005
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Edit Selection

    I have a form that includes a dropdown menu that allows a user to pick and then is sent to mysql db table. I would like to be able to let the user go back and edit the info. I can echo back the choice the user made but how do you let the user choose again from the dropdown menu. Hope that makes sense>

    Thanks

  • #2
    New Coder
    Join Date
    Jul 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You would probably want to create a separate edit page/link for the user. Then you would just query based on whatever criteria you set and use the 'UPDATE' mysql syntax.

    Good luck!

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    he's not talking about the sql syntax, he means simple selecting the right value from the drop list.

    try something like that,, asuming that you list is dynamic:
    PHP Code:
    echo "<select name='' id=''>";
    while (
    $row mysql_fetch_assoc($result)) {
      if(
    $numOriginalSelection == $row['id']){
         echo 
    "<option value='" $row['id'] . "' SELECTED>" $row['name'] . "</option>";
      } else {
         echo 
    "<option value='" $row['id'] . "'>" $row['name'] . "</option>";
      }
    }
    echo 
    "</select>"
    so, "$numOriginalSelection" would be the original selection pulled from the data base.


  •  

    Posting Permissions

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