dongra1984 2018-04-03 09:42
浏览 77

当我在第二页中使用GET方法时,我使用GET方法从一个页面获取的值保留在第二页中

This is my first page nfdata.php

<form action='drop.php' method='get'>
<tr>
<td ><input type="radio" name="radio" value="DGSTO 1">DGSTO 1</td>
<td><input type="submit" name="sub" value="Submit">

This is my 2nd page drop.php

<html>
<form id="form" action"drop.php" method="get">
    <select id="office" name="code">

    <?php
     include 'sql.php';
     if($div = $_GET['radio'])
     {
                     $div = $_GET['radio'];
                        $query="SELECT off_code_nf From non_filer where div_code_nf='$div' group by off_code_nf";
                        $sql = mysql_query($query);
                       // $row = mysql_fetch_assoc($sql);
                       //echo "<select name='to_user'>";
                            while ($row = mysql_fetch_assoc($sql))
                            {
                                echo "<option value='". $row['off_code_nf'] ."'>" .$row['off_code_nf'] ."</option>" ;
                            }
                        //echo "</select>" ;
     }
    
 ?>
 </select>
 <input type="submit" name="sub" value="Submit" />
 <br><br>
 
 <?php
    include 'sql.php';
    $inventory = $_GET['code'];
    $query= "SELECT * FROM non_filer WHERE off_code_nf = '$inventory' "; 
    $result = mysql_query($query);
    if ($inventory = $_GET['code'])
       {    
         echo "<table border='1'>
               <tr>
               <th>State Code</th>
               <th>GSTIN</th>
               
               </tr>";
       }
    while ( $row = mysql_fetch_assoc( $result ) )
                    {
                            $a = $row['state_code_nf'];
                            $b = $row['gstin_nf'];
                            Print("<tr >");
                           print("<td >$a</td>");
                           print("<td >$b</td>");
                    }
            print("</table>");
?>
</html>

I used get method in nfdata.php and get value of radio button in second page drop.php where it is selecting data from data base. but after selecting value from drop down When I am clicking on submit in drop.php page the value of drop down is not coming because there is new get method. so how to keep the value of first get method

  • 写回答

1条回答 默认 最新

  • dongli8466 2018-04-03 09:49
    关注

    <html>
    <form id="form" action"drop.php" method="get">
        <select id="office" name="code">
    
        <?php
         include 'sql.php';
    $radioVal = $_GET['radio'];
         if($div = $_GET['radio'])
         {
                         $div = $_GET['radio'];
                            $query="SELECT off_code_nf From non_filer where div_code_nf='$div' group by off_code_nf";
                            $sql = mysql_query($query);
                           // $row = mysql_fetch_assoc($sql);
                           //echo "<select name='to_user'>";
                                while ($row = mysql_fetch_assoc($sql))
                                {
                                    echo "<option value='". $row['off_code_nf'] ."'>" .$row['off_code_nf'] ."</option>" ;
                                }
                            //echo "</select>" ;
         }
        
     ?>
     </select>
    <input type="hidden" name="radio_val" value="<?=$radioVal?> />
     <input type="submit" name="sub" value="Submit" />
     <br><br>
     
     <?php
        include 'sql.php';
        $inventory = $_GET['code'];
        $query= "SELECT * FROM non_filer WHERE off_code_nf = '$inventory' "; 
        $result = mysql_query($query);
        if ($inventory = $_GET['code'])
           {    
             echo "<table border='1'>
                   <tr>
                   <th>State Code</th>
                   <th>GSTIN</th>
                   
                   </tr>";
           }
        while ( $row = mysql_fetch_assoc( $result ) )
                        {
                                $a = $row['state_code_nf'];
                                $b = $row['gstin_nf'];
                                Print("<tr >");
                               print("<td >$a</td>");
                               print("<td >$b</td>");
                        }
                print("</table>");
    ?>
    </html>

    Use $_GET['radio_val'] when click on submit button on second page

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题