how to enable certain fileds based on previous filed values?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    #1

    how to enable certain fileds based on previous filed values?

    I am creating table in mysql using php.. i want store all the details from the resume... name,email,addr ess, phone, etc........

    for example if the candidate is experienced then only he should fill the experience details such as years of experience, compnay name, etc...

    if the candidate is fresher then he need to fill the fields.

    based on the experience field entry the other fileds shoule be visible to the candidate.

    experience="fre sher" means it should not show the years of exp, comapny name fileds....
    experience="exp erience" then only the fields must visible to the candidate...


    how to do it?

    plz help...
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    There are three ways to show/hide form elements based on what has already been selected.
    1. Have the user manually enter and submit a part of the form, and have PHP show the rest of it based on what has already been submited.
    2. Have the form elements submit the form to $_SERVER['PHP_SELF'], and have PHP update the form based on what has been selected already.
    3. Use JavaScript to change the form client-side.

    The JavaScript method looks best, but requires more effort. #1 is often impractical, and it puts more effort on the user. #2 is a nice comprise if you don't want to use JavaScript.

    Comment

    • impin
      New Member
      • Jul 2010
      • 127

      #3
      could you help with a simple sample code...

      Comment

      • TheServant
        Recognized Expert Top Contributor
        • Feb 2008
        • 1168

        #4
        Have a look here for a simple javascript solution. Checking the box disables the input. It should be easy to change it to disable fields from dropdown selection.

        Comment

        Working...