Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:53:55+00:00 2026-06-14T00:53:55+00:00

I’m working on a simple php contact form and struggling to get the other

  • 0

I’m working on a simple php contact form and struggling to get the “other” selection on the dropdown to show a text field option when it’s selected. The form is included onto the page with <?php require_once('includes/contact_form.php'); ?> and the footer is also an include (the footer is where I have added the JS).

But it just wont work…

Here is the Form:

<label>How did you hear about us?</label>
<select name="how" class="selectfield" id="how">
  <option value="">Please Select...</option>
  <option value="Advertisement">Advertisement</option>
  <option value="Care at Home Today">Care at Home Today</option>
  <option value="Email-Newsletter">Email/Newsletter</option>
  <option value="Facebook">Facebook</option>
  <option value="Family-Friend">Family or Friend</option>
  <option value="Magazine">Magazine Article</option>
  <option value="Twitter">Twitter</option>
  <option value="Website-Search Engine">Website/Search Engine</option>
  <option value="Other">Other</option>
</select>
<input type='text' id="other" class="hidden" />

<input name="contactus" type="submit" class="submit" id="contactus" value="Submit" />
</form>

Here is the JS

$('#how').change(function(){
    var selected_item = $(this).val()
    if(selected_item == "other"){
        $('#other').val("").removeClass('hidden');
    }else{
        $('#other').val(selected_item).addClass('hidden');
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:53:57+00:00Added an answer on June 14, 2026 at 12:53 am

    Not sure if it is a typo in the question but your dropdown value is “Other” and in your js you are testing for “other”. So there is a mismatch. Might be your issue

    Here is a working fiddle of your example just changing the “other” to “Other” in your if statement.

    DEMO

    As coder1984 has suggested though, simply using jquery’s .show() and .hide() in your if
    statement would also work.

    if(selected_item == "Other"){
        $('#other').val("").show()
    }else{
        $('#other').val(selected_item).hide()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.