Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $no=0;
- $ans=0;
- $si=1;
- if(isset($_POST['sub']))
- {
- $no=$_POST['s'];
- }
- $rows=intdiv($no,12);
- $other=$no%12;
- ?>
- <html>
- <head>
- <title>
- task10
- </title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
- </head>
- <style>
- body{
- background-image:url('backgrounds/76.jpg');
- background-size:100%;
- background-repeat:no repeat;
- background-attachment:fixed;
- backdrop-filter:blur(5px);
- margin:0;padding:0;height:100vh;
- }
- h1{
- background-color:black;
- color:white;
- font-size:50px;
- font-family:supernatural-knight;
- text-align:center;
- }
- .l
- {
- background-color:black;
- color:white;
- font-size:30px;
- }
- .l1
- {
- border-size:0.2;
- border-color:white;
- background-color:rgba(234, 141, 87, .8);
- Color:white;
- width:100%;
- }
- </style>
- <body>
- <h1> Task -10 </h1>
- <form method="post">
- <table align="center">
- <tr>
- <td><input class="l" type="textbox" name="s" placeholder="no of buttons"></td>
- <td><input class="l" type="submit" name="sub"></td>
- </tr>
- </table>
- </form>
- <div class="container jumbotron" style="background-color:rgba(255, 255, 255, .2); ">
- <div class="row">
- <?php
- if($no>0)
- {
- $count=0;
- $n=$no;
- for($i=0;$i<=$rows;$i++)
- {
- while($rows!=0)
- {
- for($j=1;$j<=12;$j++)
- {
- ?>
- <div class="col-md-<?php echo $si;?>">
- <button class="btn l1" ><label ><?php echo $count+1;?></label></button>
- </div>
- <?php
- $count++;
- }
- $rows--;
- }
- $ans=0;
- if($other>0)
- {
- while($other>6 || $other==5 )
- {
- $ans+=1;
- $other--;
- }
- }
- $temp=0;
- if($ans>0)
- {
- while($ans>6 || $ans==5 )
- {
- $temp++;
- $ans--;
- }
- }
- if($other!=0)
- {
- $si=12/$other;
- for($j=1;$j<=$other;$j++)
- {
- ?>
- <div class="col-md-<?php echo $si;?>">
- <button class="btn l1" ><label ><?php echo $count+1;?></label></button>
- </div>
- <?php
- $count++;
- }
- }
- if($ans!=0)
- {
- $si=12/$ans;
- for($j=1;$j<=$ans;$j++)
- {
- ?>
- <div class="col-md-<?php echo $si;?>">
- <button class="btn l1" ><label ><?php echo $count+1;?></label></button>
- </div>
- <?php
- $count++;
- }
- }
- if($temp!=0)
- {
- $si=12/$temp;
- for($j=1;$j<=$temp;$j++)
- {
- ?>
- <div class="col-md-<?php echo $si;?>">
- <button class="btn l1" ><label ><?php echo $count+1;?></label></button>
- </div>
- <?php
- $count++;
- }
- }
- }
- }
- else
- {
- ?><label class="l1" style="font-size:30px;font-family:Supernatural Knight"><center> ERROR: Button no should be "0 <" </center> </label> <?php
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement