0

I want to select one value from the dropdown page and it should directly link to the .php file associated with it. How can I do that?

<td>
<select onchange="location = this.value;">
    <option value="nil"> Select an option from below</option>
    <option action="update_user.php">Update User</option>
    <option action="update_project.php">Update a Project</option>
</select>
</td>
Vishvachi Sinha
  • 147
  • 1
  • 4
  • 10
  • 1
    There are many answers already. for e.g. https://stackoverflow.com/questions/5150363/onchange-open-url-via-select-jquery – tech2017 Aug 26 '19 at 19:11

2 Answers2

2

Try this:

 <select onChange="window.document.location.href=this.options[this.selectedIndex].value;">
  <option vlaue="https://example.com/">Option 1</option>
  <option vlaue="https://example.net/">Option 2</option>
  <option vlaue="https://example.org/">Option 3</option>
  </select>
era-net
  • 387
  • 1
  • 11
0

Js



function location(url)
{

  location.href=url;

}



Html


<select onchange="location(this.value)">
        <option value="https://example.com/">Option 1</option>
        <option value="https://blabla.net/">Option 2</option>
        <option value="https://urle.com">Option 3</option>
  </select>


dılo sürücü
  • 3,821
  • 1
  • 26
  • 28