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 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100