页面刷新时不显示数据库值

时间:2014-04-14 15:02:35

标签: php

我正在构建一个表单,其中两个组合框第一组合具有超过6个值而2和组合只有2个值当用户从组合中选择时选择任意值并且还选择组合2第一个值并按提交然后我打开home.php是从数据库中获取值并显示。 problm -1- 但是当我刷新页面值时不打印。 问题-2- 接下来我想要当用户从combo1中选择时选择任意值并从combo2中选择并选择第二个值然后打开另一个页面。

  <?php 
  session_start();
    ?>
 <html>
 <body>
      <fieldset>


       <select id = "myList" name= "casetype" class="form-login" style="width:250px;" >
           <option value = "D">D</option>
           <option value = "E">E</option>
           <option value = "A">A</option>
           <option value = "C">C</option>
           <option value = "F">F</option>
           <option value = "S">S</option>
           <option value = "B">B</option>
           <option value = "W">W</option>
           <option value = "T">T</option>
           <option value = "R">R</option>
         </select>

    </fieldset>



    </div>
   <div id="login-box-name" style="margin-top:20px;">
   Revision:</div>
  <div id="login-box-field" style="margin-top:20px;">
  <fieldset>


         <select id = "myList" name="revision" class="form-login" style="width:250px;">
           <option value = "1">R0</option>
           <option value = "2">R1</option>

         </select>
   </fieldset>



           <?php 

         $_SESSION['var']=$_POST['casetype'];
    mysql_connect("localhost", "root","") or die(mysql_error()); 

      mysql_select_db("Court1") or die(mysql_error()); 
  $data = mysql_query("SELECT * from causelist WHERE 
   CaseType= '" . $_SESSION['var'] . "'") 
  or die(mysql_error()); 


    while($info = mysql_fetch_array( $data )) 

    {

   Print " <td width=15px style=word-wrap:break-word;text-align:center;height:40px; >";
     echo $info['CaseNo'];
     print"</td> "; 
    Print " <td style=word-wrap:break-word;text-align:left; width=20px;height:40px;>";
     echo $info['Party2'];
     print"</td> "; 
    Print " <td style=word-wrap:break-word;text-align:left; width=20px;height:40px;>";
     echo $info['Party2'];
     print"</td> ";
      print"</tr> ";
      print"</table> ";

0 个答案:

没有答案