View Full Version : Hide/show a text box based on drop down list in php

01-11-2008, 08:23 AM

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.


01-11-2008, 11:57 AM
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 (http://www.codingforums.com/forumdisplay.php?f=2) forum if you need any more help with this! :)