Jump to content

Launching a link directly from a menu selection


vbcoach

Recommended Posts

Hello once again.

 

From within a form I have a PHP call to a MsSql database for available leagues and returns some basic information.  It's in a dropdown menu.

 

What I would like to do is when a user makes a selection from that form, I would like this form to immediate launch either the results in the same page, or launch a link to a new page with the requested information.  Attached is the code I am using.  I am trying to avoid multiple key or mouse presses.  Just select the league - and then go there.

 

<label>List registered teams for

<select name="league" tabindex="2" >

    <option value="" selected="selected">-- Select League --</option>

    <?php  while ($lrow = mssql_fetch_assoc($lres))  {    ?>

    <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[night] $lrow[type] $lrow's $lrow[division]"; ?></option>

    <?php

                }

?>

 

Then I either want the results printed below the selection, or a new page launched to http://www.somewebsite.com/viewleague.php?l= <selected league ID goes here> 

 

Does this make sense?

Ok, so far so good.  However my drop down menu is dynamically created.  I want to take the variable $lrow['l_id'] and add it to the end of http://www.mywebsite.com/info.php?l=  then launch URL.

 

The example you gave me has static addresses and I cannot figure out how to add my website url to the script.

 

Any thoughts?

<label>List registered teams for
<select name="league" tabindex="2" OnChange="location.href=this.value">
<option value="" selected="selected">-- Select League --</option>
<?php  while ($lrow = mssql_fetch_assoc($lres))      {    ?>
<option value="http://www.mywebsite.com/info.php?l=<?php echo $lrow['l_id'];?>"><?php echo "$lrow[night] $lrow[type] $lrow[size]'s $lrow[division]"; ?></option>
<?php
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.