I'm trying to make a dynamic web page that return a list based on the choice in a drop down menu.

Lets say I have two customers and the orders they have requested.

If I choose Customer1, I want the orders Customer1 has ordered listed on the page without useing a submit button. If I choose Customer2, I want Customer2's orders to be listed on the page.

It does not matter that the page has to reload. I just want it to reload without using a submit button.

Any sugestions on how to get the web page to reload when I have choosen the correct customer??? I guess this is more a HTML or Java question, then PHP, but am greatful for YOUR help :-)

Kj

    <select name=what onChange="javascript:location=<?=$PHP_SELF?>">

    that should reload the page.. (i think its onChange..)

      Hei Brøken.

      Your answer was in the ballpark, but I had to modify it. After some testing the result for my problem was a mix of html and java.

      To refresh the page after chosen the right subject in the drop down menu, I did it like this;

      echo "<form name='groupform'>
      <select name='group' onChange='javascript:location=this.form.group.options[this.form.group.selectedIndex].value;'>
      <option selected value=''>Choices...</option>
      <option value='newbill.php'>Reload this page</option>
      <option value='index.php'>Back to front page</option>
      <option value='newbill.php?action=new'>Reload and do something</option>
      </select>
      </form>";
      

      What surprised me was the <form> tag. However, thank you for your help, Brøken.

      Mvh,

      Kj.

        ah, glad i was some help 🙂 i dont use javascript a lot now since ive been learning php

          Write a Reply...