1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP Field Visibility Help

Discussion in 'Web Design & Development' started by KSL, May 1, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. KSL

    KSL Thread Starter

    Joined:
    Apr 18, 2008
    Messages:
    6
    I have put a contact us form on my website which uses PHP to send the forms results in an email. Now I did not write the code myself I found it on a freeware website. The code works great and sends the form perfectly it even has a simple form of Captcha. Now my problem is I want to tweak the code but I don’t know how.

    My current form has a number of Text boxes and a number of drop down selection boxes. What I want to do is make a text field invisible until someone selects an option in the selection box.

    To elaborate I am SEOing the website and I want a "Where did you find us" Selection box and if someone selects Google I want a new text box to display asking what search term they used.

    I would be grateful for some help.


    KSL
     
  2. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    You'll need some Javascript on the selection box:
    HTML:
    <select>
    <option value='google' onSelect='document.getElementById('googleSearch').visible = true'>google</option>
    </select>
    <input type='text' name='googleSearch' visible='false'/>
    
    That should make the googleSearch box invisible until the person selects 'Google' from the drop down list.
     
  3. KSL

    KSL Thread Starter

    Joined:
    Apr 18, 2008
    Messages:
    6
    Thanks worked a treat
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/708897