Page 1 of 1

Automatic link - *solved*

Posted: Fri Mar 11, 2005 9:47 am
by knight666
This might be a silly question, but I really need it.
I need to know how you can automatically go to a link when you select an option from a drop down box.

This is my current code:

Code: Select all

<select name="MedeWerker">
    <?php 
     if ($LidBedrijf)
     {
     $Database2=mysql_query("SELECT * from Mw_Hdr where LidHdrNr = '$LidBedrijf';");
     while($Rij2=mysql_fetch_array($Database2))
      {
      echo "<option value=\"";
      echo $Rij2["MwHdrNr"]."\"";
      if($MedeWerker==$Rij2["MwHdrNr"]){echo "selected";}
      echo ">";
      echo $Rij2["MwRoepnaam"]."</option>\n";
      }
     }
    ?>
   </select>
The variables are not that important, they work right now. :)
So yeah, just that tiny thing.

The point of this script is that you can select a company from a first drop down box, and it will give a list of employees in a second drop down box.
If you select an employee from that list, it will give you all the information about that person from the database.
If there's a 'cleaner' way to display the employee's information after you selected him/her, please let me know.

I have a number of books around me, but I can't find what I need. :cry:

Please note: I only just started working with PHP.
I have average knowledge of HTML though.

Thanks in advance!

-knight666


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Fri Mar 11, 2005 9:59 am
by feyd
search the boards for 'jumpbox OR onchange'

Posted: Fri Mar 11, 2005 10:13 am
by knight666
Thanks, the code:
<select name="MedeWerker" OnChange="submit();">
did the trick. :D