Automatic link - *solved*

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
knight666
Forum Newbie
Posts: 5
Joined: Fri Mar 11, 2005 9:40 am
Location: Kerkdriel, the Netherlands

Automatic link - *solved*

Post 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]
Last edited by knight666 on Fri Mar 11, 2005 10:18 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search the boards for 'jumpbox OR onchange'
knight666
Forum Newbie
Posts: 5
Joined: Fri Mar 11, 2005 9:40 am
Location: Kerkdriel, the Netherlands

Post by knight666 »

Thanks, the code:
<select name="MedeWerker" OnChange="submit();">
did the trick. :D
Post Reply