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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Retrieving Info For Modification

    I have a drop down select box and need to know how to recall all the info that option has and have it post it's info into the form fields below it. How is that done. Because it'll give the user the ability to edit the info and then click "Update" and it'll change the info.

    http://www.kansasoutlawwrestling.com/edittitle.php

  • #2
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Do you mean like
    Code:
    $_POST["titlename"];
    ?

    EDIT: Or do you mean pulling the information from the database? Like

    Code:
    $titlename = $row["titlename"];
    
    <input type="text" name="titlename" value="$titlename">
    So whatever value they have in the database, it will keep that value in the box, so you can see what is currently in the database? So if you have "Champion" as a title in the database, the title name text box would say "Champion" in it at all times, until its changed.
    Last edited by masterofollies; 07-31-2008 at 05:03 PM. Reason: .

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    No.

    Go to the page I listed and notice how I have the drop down select menu above a form. Upon selection of a title it will go to my database and retrieve that titles info and place it's corresponding info into the form fields below so that the user can edit it and the click update and it'll replace the new info with the old info.

  • #4
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    You need AJAX for that. The drop down menu would need an onchange="ajax_function()" inside of the <select> tag. You would have to define ajax_function() as a javascript function elsewhere in the document. For that, you should really ask here

    Essentially how it works is this (extremely simplified): the ajax/javascript function that is called from onchange will check what the current selected value in the menu is and send it as a parameter to a .php file. The php file retrieves the parameter with the $_POST or $_GET arrays. The file pulls what ever info you need from the database, formats it, and gives it back to the javascript function. The javascript function then sets some other div's inner HTML to whatever was retrieved from the php file. I never knew Javascript but was able to learn it well enough from this link to do what you're talking about.
    Last edited by derzok; 07-31-2008 at 06:03 PM.
    zok@zoklet:~$ whereis zok
    zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com


  •  

    Posting Permissions

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