Hi i am new to PHP so this may (hopefully) just be a simple problem.
I am creating a contact form on my website using some freeware code i have found. The page works perfectly but i wanted to do a little tweeking.
In my form i have the question with a list/menu box "where did you find us", one of the selections is google. When this is selected by the user i want a previously hidden text field to appear asking which search term they used to find our site.
Can anybody help out with this code?
Cheers
KSL
Textfield visibility
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Textfield visibility
You could do this with PHP by it would mean the user would have to click a submit button - not very good.
Your best bet would be to use Javascript.
Your best bet would be to use Javascript.
Re: Textfield visibility
Ya, you should use Javascript for this.
Something like (not tested):
If the javascript solution is what you're looking for, I can move this thread to the Client-Side forum if you want.
Something like (not tested):
Code: Select all
function showField()
{
if(document.getElementById('pulldown').value == 'google');
document.getElementById('myHiddenField').style.display = 'inline';
else
document.getElementById('myHiddenField').style.display = 'none';
}
.....
<select id = "pulldown" onchange = "showField();" >
...
</select>
<input type = "text" id = "myHiddenField" style = "display:none;" />
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Textfield visibility
Thank you all sorted now.