显示的表的每一行中的更新按钮

时间:2017-12-27 09:26:41

标签: php

我想显示表中的所有行,并且我想在显示日期选项的每一行中获得更新按钮。但我得到以下错误:

  

未定义的索引br,rg,批次

我没有得到我错的地方。我正在给我的代码。当我单击相应行中的更新按钮时,SQL表将使用相应date的相应rollnumber进行更新。

 <html>
     <head>
       <link rel="stylesheet" type="text/css" href="header.css" />
       <script src="jquery.min.js"></script>
       <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js">                    </script>
        <script>
          $( function() {
               $( ".date" ).datepicker({dateFormat:'yy-mm-dd'});
             } );

      </script>
     <style>
       body 
       {
            background-color: #FFFFF2;
       }
     .date
     {
        width:70px;
     }
    .design
    {

       border: 1px solid red;
       border-collapse:collapse;
        text-align:center;  
    }

         tr
          {
          height:35px;
            }
           th
        {
             background-color:lightgreen;
          border: 1px solid red;
         height:50px;

          }
           td
          { 
           border: 1px solid red;
          font-size:13px;
            height:10px; 
           }
                .design tr:hover
          {
        background-color:#FFA600;
           font-weight:bold;
         }
        </style>
         </head>

           <?php

          include('connect.php');


            $br=$_POST['branch'];
            $rg=$_POST['reg'];
            $batch=$_POST['batch'];


             $br1=0;
             $year=0;
             $sem=0;

             if($rg=='R13')
           {

           if($br==1)
              {
           $br1="CIVIL";
            }
              else if($br==2)
             {
           $br1="EEE";
             }
               else if($br==3)
              {
             $br1="MECH";
              }
                else if($br==4)
              {
             $br1="ECE";
                  }
              else if($br==5)
                {
                    $br1="CSE";
                }
                   else
                       {
                 $br1="IT";
                       }


                      echo"<center><u><h2>Degree Eligibility List($br1)                                                                             ($batch batch)</h2></u></center>";

                    $sl=1;
                     $i=1;
                      $k=0;
               $mrk=0;
               $int=0;
                $ext=0;
               $bl=0;
              $marks=0;
               $total=0;
               $crd=0;
              $per=0;
               $grade=0;

             echo"<center><table class='design'>"; 
             echo"<thead><th>S.No</th>
              <th>Roll Number</th>
               <th>Obtained</th>
               <th>MaxMarks</th>
                <th>Percent</th>
                  <th>credits</th>
                     <th>Backlogs</th>
                  <th>Eligibility</th>
                       <th>PC mode</th>
                   <th>PC apply date</th>
                    <th>PC recieve date</th>
                     </thead>"; 

                      $sql1="select rollno from pc where branch='$br' and       batch='$batch'";
                      $ret1=mysql_query($sql1);
                    while($row1=mysql_fetch_array($ret1))
                         {
                         //echo"<tr>";
                       //echo"<td>".$sl++."</td>";
                             $rno=$row1['rollno'];
                        $sql="select * from data where rollno='$rno'  order by year asc, sem asc, subcode asc, my desc, type desc";   
                     $ret=mysql_query($sql);


                   while($row=mysql_fetch_array($ret))
                   {
                     $int=$row['internal'];
                        $ext=$row['external'];
                           $j=$row['credits'];
                                $temp=$row['subcode'];

                     if(strcmp($temp,$k)<>0)
                       {
                      $sql2="select * from sforms where scode='$temp'";   
                      $ret_sub=mysql_query($sql2);
                      $row_fetch=mysql_fetch_array($ret_sub);
                         $max=$row_fetch['maxmarks'];

                        if($row['external']=='-1')
                          {
                        $mrk=$int;            
                           }
                            else
                              {
                              $mrk=$row['internal']+$row['external'];         
                                }

                               if($j==0)
                                 {
                               $bl++;
                               $marks=$marks+$mrk;
                               $total=$total+$max;                     
                               }
                                  else
                                   {
                             $marks=$marks+$mrk;
                             $total=$total+$max;    
                              $crd=$crd+$j;                     
                               }        

                             $k=$temp;   
                                } 

                               }
                              if($total<>0)
                              {
                           $per=round(($marks/$total)*100,2);
                            echo"<tr>";
                            echo"<td>".$sl++."</td>";
                            echo"<td>$rno</td>";
                            echo"<td>$marks</td>";
                            echo"<td>$total</td>";
                            echo"<td>$per</td>";
                            echo"<td>$crd</td>";
                            echo"<td>$bl</td>";
                            if($bl==0)
                            {
                           echo"<td>Eligible</td>";
                           echo"<td><form method='post' action=''>          
                            <select name='mode' required>
                               <option value=''>--select--</option>
                               <option value='T'>Tatkal</option>
                               <option value='C'>College</option>
                               </select></td>";
                         echo"<td><input  type='text' name='date'  class='date' required><input type='submit' name='Submit' class='submit'       value='Update' /></form></td><td></td></tr>";        
                                }
                                else
                                {
                               echo"<td></td><td></td><td></td><td></td></tr>";

                               }
                                 }

                        $marks=0;
                         $total=0;
                        $per=0;
                          $bl=0;
                           $crd=0;

                             }  
                              echo"</table></center>";
                                 }  

2 个答案:

答案 0 :(得分:0)

//使用此代码编辑按钮..

<td><a href="set your url.." title="Edit" style="color:blue;font-size: 16px;color: #1caadc;font-weight: bolder;"><i class="fa fa-pencil-square-o"></i>
                                    </a></td>

答案 1 :(得分:0)

$br=$_POST['branch'];
$rg=$_POST['reg'];
$batch=$_POST['batch'];

尝试打印这些值并检查。确保从表单中传递值。