doufei2007 2017-12-27 09:26
浏览 41

显示的每一行中的更新按钮[重复]

This question already has an answer here:

I want to display all rows from the table and i want to get update button in each row with the date option displayed. But i am getting below error:

undefined index br, rg, batch

I didn't get where i went wrong. I am giving my code. When i click the update button in the respective row, the SQL table gets updated with the respective date to the respective 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>";
                                 }  
</div>
  • 写回答

2条回答 默认 最新

  • doubi1713 2017-12-27 09:29
    关注

    // use this code for edit button ..

    <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>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?