Jump to content

[SOLVED] Select box is not going to URL on selection change


aeafisme23

Recommended Posts

I am trying to get my select box to work without a submit button. I have already made one that works just fine but when i put in php variables it does not seem to work. here is what i got

 

 

<form>
<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
    <tr>		
	<td width="20" valign="top"> </td>
        <td width=250 valign="top">
        <p class="small">
          <SELECT NAME="nav" onChange="document.location.href=document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value">
           <OPTION VALUE="#" SELECTED> - Select a DMA to pull a report - </option>
<?php

while($results = mysql_fetch_array($sql_address)){
    $stationID = $results['station_id'];
    $dmaID = $results['dma_id'];

    echo"<option value=\"view_records.php?station=$stationID\">$dmaID</option>";

    // Increment the row count
    $row_count++;
}

// Free the MySQL resource
mysql_free_result($sql_address);
?>
</select></p></td>...</form>

 

im pretty sure ive messed this line up somehow to make it not work properly

 

echo"<option value=\"view_records.php?station=$stationID\">$dmaID</option>";

 

By the way i can get it to work with a submit button but do not want that alternative.

 

 

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.