Re: PHP, create link behind a drop down list box!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In your select element, modify your onchange statement to this:
onchange="document.location.href=this.value;"
- you won't need the submitform function.

HTH.

--- In php-objects@xxxxxxxxxxxxxxx, Sana Alamgeer <sanalmgr47@...> wrote:
>
> 
> hello everyone
> here i have a php code
> i wantto create a link to a specific page behind the drop down list box, while data is coming from databse.
> when user clicks on any item in list, a concerned page should open in frame f4. here is the code, please correct this, or help me, partial code i m sending.
> <SCRIPT language="JavaScript">
> function submitform()
> {
>   document.form1.submit();
> }
> </SCRIPT>
> =================
>    <form action="<?php $_SERVER['../sana/PHP_SELF']; ?>" name="form1" method="post">
>    <table width="500px" cellpadding="0" cellspacing="0" align="left">
>     <tr>
>      <td>
>       <select name="mem_year" onchange="submitform();">
>              <?php 
>         $sql="select id, page_name from tab_1";
>         $sqlstmt=mysql_query($sql);
>         echo "<option value='--'>Page Name</option>";
>         while($result=mysql_fetch_array($sqlstmt)){
>         echo "<option value=".$result["id"].">".$result["page_name"]."</option>"; 
>         $i++;
>         }
>        ?>
>       </select>
>      </td>
>     </tr>
>    </table>
>    </form>
> =====================   
> <?php
> switch ($_POST['mem_year']):
>     case "1":
>  echo '<a href="f1.php"?target=f4></a>';
>        break;
>     default:
>        echo "Error: Action must be either one option";
> endswitch;
> ?>
> </body>
> </html>
> SanaAlamgeer 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>       
> 
> [Non-text portions of this message have been removed]
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux