Facebook
From zzzzzzz, 3 Years ago, written in HTML5.
Embed
Download Paste or View Raw
Hits: 50
  1. <?php
  2.    $con = mysqli_connect("localhost","root","","student");
  3.    $page = 1 ;
  4.  
  5.    if(isset($_POST['search'])){
  6.        $page = 2;
  7.        $id = $_POST['id'];
  8.        $sql = "select * from addmission_info where id = $id" ;
  9.        $res = mysqli_fetch_assoc(mysqli_query($con , $sql));
  10.    }
  11.    if(isset($_POST['update'])) {
  12.        $a =$_POST['name'];
  13.        $b=$_POST['fname'];
  14.        $c=$_POST['mname'];
  15.        $d=$_POST['date'];
  16.        $e=$_POST['class'];
  17.        $f=$_POST['fee'];
  18.        $g=$_POST['address'];
  19.        $k="update addmission_info set name='$a',f_name='$b',m_name='$c', A_date='$d', class='$e', addmission_fee='$f', address='$g' where id='$d' ";
  20.        $res= mysqli_query($con,$k);
  21.        $page = 3;
  22.    }
  23.  
  24.  
  25. ?>
  26.  
  27. <!DOCTYPE html>
  28. <html lang="en">
  29.     <meta charset="UTF-8">
  30.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  31.     <title>update</title>
  32. </head>
  33.         <?php
  34.        
  35.            if($page == 1)
  36.            {
  37.        ?>
  38.                 <form action="" method="post">
  39.                 <input type="number" name="id" placeholder="enter your id">
  40.                 <input type="submit" name="search" value="search">
  41.                 </form>
  42.      <?php
  43.    
  44.            }
  45.  
  46.            else if($page==2){
  47.            
  48.     ?>
  49.  
  50.      <form action="" method="post">
  51.         <table>
  52.             <tr>
  53.                 <td>id</td>
  54.                 <td> <input type="number" name="sid" value="<?php echo $res['id']?>" >  </td>
  55.             </tr>
  56.             <tr>
  57.                 <td> Your name</td>
  58.                 <td><input type="text" name="name" value="<?php echo $res['name']?>"></td>
  59.             </tr>
  60.             <tr>
  61.                 <td> Your Father name</td>
  62.                 <td><input type="text" name="fname" value="<?php echo $res['f_name']?>"></td>
  63.             </tr>
  64.             <tr>
  65.                 <td> Your Mother name</td>
  66.                 <td><input type="text" name="mname" value="<?php echo $res['m_name']?>"></td>
  67.             </tr>
  68.             <tr>
  69.                 <td> Addmission date</td>
  70.                 <td><input type="date" name="date" value="<?php echo $res['A_date']?>"></td>
  71.             </tr>
  72.             <tr>
  73.                 <td> Your class</td>
  74.                 <td><input type="number" name="class" value="<?php echo $res['class']?>"></td>
  75.             </tr>
  76.             <tr>
  77.                 <td> Your addmission fee</td>
  78.                 <td><input type="number" name="fee" value="<?php echo $res['addmission_fee']?>"></td>
  79.             </tr>
  80.             <tr>
  81.                 <td> Your address</td>
  82.                 <td><input type="text" name="address" value="<?php echo $res['address']?>"></td>
  83.             </tr>
  84.             <tr>
  85.                 <td><input type="submit" value="update" name="update"></td>
  86.             </tr>
  87.         </table>
  88.      </form>
  89. <?php
  90.  
  91.            }
  92.            else{
  93.                if($res)
  94.                {
  95.                    echo "update secss";
  96.                }
  97.                else
  98.                    echo"not secss";
  99.            }
  100.  
  101. ?>
  102.    
  103. </body>
  104. </html>