Adding section in form depending on user

Discussion in 'PHP' started by Peuplarchie, Dec 16, 2008.

  1. #1
    Good day to you all,
    here i come again with a probably easy question for you but I can't find what i'm looking for.


    What I have:
    Simple form....
    
    <input name="artist" value="Artist" />
    <input name="country" value="Country" />
    
    <input name="cd" value="Album" />
    <input name="year" value="year" />
    <input name="price" value="price" />
    
    PHP:

    MY GOAL:


    Have a link that would add a section into the form dynamicly with out reloading of the page. (add an album from this artist)
    
    <input name="cd" value="Album" />
    <input name="year" value="year" />
    <input name="recorded" value="Recorded" />
    
    PHP:

    BUT:
    Here is the twist, I need to be able if to add another section for DVD.
    Different field is required for this...
    
    <input name="DVD" value="DVD" />
    <input name="year" value="year" />
    <input name="where" value="where" />
    
    PHP:

    I know there will be some JS and CSS but I think the core could be PHP.


    Thanks for any help, I still searching, directions would be nice...
     
    Peuplarchie, Dec 16, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Yes and no, you can make a choice of 2 options.

    option 1 is using a select field with all options available in your database and place this before the text field (users can select an existing option) wich can fill with a tiny piece of javascript the text input with the selected value.

    option 2 is using javascript and php (ajax) to suggest options, look on google for ajax and suggestion script
     
    EricBruggema, Dec 17, 2008 IP