Advertisement
Aniket_Goku

task10

Jul 8th, 2021
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php
  2.     $no=0;
  3.     $ans=0;
  4.     $si=1;
  5.     if(isset($_POST['sub']))
  6.     {
  7.         $no=$_POST['s'];
  8.        
  9.     }
  10.     $rows=intdiv($no,12);
  11.             $other=$no%12;
  12.            
  13.     ?>
  14. <html>
  15.     <head>
  16.     <title>
  17.         task10
  18.     </title>
  19.      <meta charset="utf-8">
  20.   <meta name="viewport" content="width=device-width, initial-scale=1">
  21.   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  22.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  23.   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  24.   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  25.     </head>
  26.     <style>
  27.         body{
  28.             background-image:url('backgrounds/76.jpg');
  29.             background-size:100%;
  30.             background-repeat:no repeat;
  31.             background-attachment:fixed;
  32.             backdrop-filter:blur(5px);
  33.             margin:0;padding:0;height:100vh;
  34.         }
  35.         h1{
  36.             background-color:black;
  37.             color:white;
  38.             font-size:50px;
  39.             font-family:supernatural-knight;
  40.             text-align:center;
  41.         }
  42.         .l
  43.         {
  44.             background-color:black;
  45.             color:white;
  46.             font-size:30px;
  47.         }
  48.         .l1
  49.         {
  50.             border-size:0.2;
  51.             border-color:white;
  52.             background-color:rgba(234, 141, 87, .8);
  53.  
  54.             Color:white;
  55.             width:100%;
  56.         }
  57.        
  58.     </style>
  59.     <body>
  60.         <h1> Task -10 </h1>
  61.         <form method="post">
  62.             <table align="center">
  63.                 <tr>
  64.                     <td><input class="l" type="textbox" name="s" placeholder="no of buttons"></td>
  65.                     <td><input class="l" type="submit" name="sub"></td>
  66.                 </tr>
  67.             </table>
  68.         </form>
  69.         <div class="container jumbotron" style="background-color:rgba(255, 255, 255, .2); ">
  70.             <div class="row">
  71.         <?php
  72.            
  73.             if($no>0)
  74.             {
  75.             $count=0;
  76.            
  77.             $n=$no;
  78.             for($i=0;$i<=$rows;$i++)
  79.             {
  80.                 while($rows!=0)
  81.                 {
  82.                     for($j=1;$j<=12;$j++)
  83.                     {
  84.                         ?>
  85.                         <div class="col-md-<?php echo $si;?>">
  86.                             <button class="btn l1"  ><label ><?php echo $count+1;?></label></button>
  87.                         </div>
  88.                         <?php  
  89.                         $count++;
  90.                    
  91.                     }
  92.                     $rows--;
  93.                 }
  94.                 $ans=0;
  95.                
  96.                 if($other>0)
  97.                 {
  98.                     while($other>6 || $other==5 )
  99.                     {
  100.                             $ans+=1;
  101.                             $other--;
  102.                     }
  103.                    
  104.                    
  105.                        
  106.                 }
  107.                 $temp=0;
  108.                 if($ans>0)
  109.                 {
  110.                     while($ans>6 || $ans==5 )
  111.                     {
  112.                             $temp++;
  113.                             $ans--;
  114.                            
  115.                     }
  116.                    
  117.                    
  118.                        
  119.                 }
  120.                 if($other!=0)
  121.                 {
  122.                     $si=12/$other;
  123.                     for($j=1;$j<=$other;$j++)
  124.                     {
  125.                         ?>
  126.                         <div class="col-md-<?php echo $si;?>">
  127.                             <button class="btn l1"  ><label ><?php echo $count+1;?></label></button>
  128.                         </div>
  129.                         <?php  
  130.                         $count++;
  131.                    
  132.                     }  
  133.                 }
  134.                 if($ans!=0)
  135.                 {
  136.                     $si=12/$ans;
  137.                     for($j=1;$j<=$ans;$j++)
  138.                     {
  139.                         ?>
  140.                         <div class="col-md-<?php echo $si;?>">
  141.                             <button class="btn l1"  ><label ><?php echo $count+1;?></label></button>
  142.                         </div>
  143.                         <?php  
  144.                         $count++;
  145.                    
  146.                     }  
  147.                 }
  148.                 if($temp!=0)
  149.                 {
  150.                     $si=12/$temp;
  151.                     for($j=1;$j<=$temp;$j++)
  152.                     {
  153.                         ?>
  154.                         <div class="col-md-<?php echo $si;?>">
  155.                             <button class="btn l1"  ><label ><?php echo $count+1;?></label></button>
  156.                         </div>
  157.                         <?php  
  158.                         $count++;
  159.                    
  160.                     }  
  161.                 }
  162.                
  163.                
  164.            
  165.            
  166.             }
  167.             }
  168.             else
  169.             {
  170.                 ?><label class="l1" style="font-size:30px;font-family:Supernatural Knight"><center> ERROR: Button no should be "0 <" </center> </label> <?php
  171.                
  172.             }
  173.         ?>
  174.            
  175.             </div>
  176.         </div>
  177.     </body>
  178. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement