Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Thanked 0 Times in 0 Posts

    Hide/show a text box based on drop down list in php


    I am looking for php code that will enable me to hide/show a text box based on the users previous drop down list response. If javascript comes into use for it,
    its a welcome solution

    (1) I want the "additional" text box to ONLY display if the user answers the drop down list with "yes"
    (2) If the user answers "no" to the previous drop down list I don't want the "additional" text box displayed
    (3) When the form is originally opened I dont want it to display the "additional" text box.


  • #2
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Thanked 19 Times in 18 Posts
    Hi there,

    You can only do what you want with javascript since you will be manipulating the contents of the page once it has been loaded by the client. Javascript is client-side, php is server-side.

    Here's a solution I found on Google, you could adapt it for your needs: http://www.thescripts.com/forum/thread88791.html

    Anyway, I suggest that you re-post in the javascript forum if you need any more help with this!


    Posting Permissions

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