if a or b selected from select menu i want to submit values else other is selected from select menu i want to redirect to other website please help me urgent.

** my form code is **

 <table> 
 <tr>

    <td><label>
      <select name="community" id="select7" >
        <option value="a">a</option>
        <option value="b">b</option>
        <option value="other">other</option>
      </select>
    </label></td>
  </tr>
  <tr>
    <td><input type="submit" name="button" id="button" value="search" tabindex="50" /></td>
  </tr>
</table>

Thanks you,

Recommended Answers

All 3 Replies

I think this is a JavaScript question, also, the label tags are wrong and nothing will work if it's not within <form></form> tags

Change line 5 to:

<select name="community" id="select7" onchange="javascript:if(this.value=='other')window.location.href='REDIRECT/PATH/HERE';">

If you need this to be more scalable, you can make it a JS function instead.

EDIT: Good catch, TonyG. Those <label> tags don't belong there, and while the onchange will handle redirects, submitting won't work without <form> tags.

working perfectly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.