sueckreimir

ucenici/uredi

Sep 25th, 2019 (edited)
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.71 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8.     <head>
  9.         <meta charset="UTF-8">
  10.         <title></title>
  11.     </head>
  12.     <body>
  13.         <?php
  14.        
  15.         require 'konekcija.php';
  16.        
  17.         if(isset($_GET['mbr']))
  18.         {
  19.            
  20.             $mbr=$_GET['mbr'];
  21.             $broj=$_GET['broj'];
  22.             echo '<a href="index.php?mbr='.$mbr.'&broj='.$broj.'">'.'<i><b>'
  23.             .'Natrag-index'.'</i></b>'.'</a>'.'<br>';
  24.            
  25.            
  26.             $query="select mbrStud,imeStud,prezStud
  27.            from stud
  28.            where mbrStud=$mbr";
  29.             $result= mysqli_query($link, $query);
  30.             $fetch= mysqli_fetch_assoc($result);
  31.            
  32.             if(isset($_POST['submit']))
  33.             {
  34.                 $submit=$_POST['submit'];
  35.                 $ime=$_POST['ime'];
  36.                 $prezime=$_POST['prezime'];
  37.                
  38.                
  39.                 $stmt=$link->prepare("UPDATE stud SET imeStud=?, prezStud =? WHERE stud.mbrStud =?");
  40.                 $stmt->bind_param("sss",$ime,$prezime,$mbr);
  41.                 $status=$stmt->execute();
  42.                
  43.                        
  44.                
  45.                 if($status==TRUE)
  46.                 {
  47.                     echo '<a href="index.php?mbr='.$mbr.'&broj='.$broj.'">'.
  48.                          'Izmjena podataka uspjela,vidi promjenu'.'</a>'.'<br>';
  49.                     echo '<table>';
  50.                     echo '<tr><td>'.'<i>'.$fetch['imeStud'].'</i>'.'<td>'.' je izmjenjeno u '.'<td>'.'<i>'.$ime.'</i>'.'<tr>';
  51.                     echo '<tr><td>'.'<i>'.$fetch['prezStud'].'</i>'.'<td>'.' je izmjenjeno u '.'<td>'.'<i>'.$prezime.'</i>'.'<tr>';
  52.                     echo '</table>';
  53.                 }
  54.                 else
  55.                 {
  56.                     echo '<br>'.'Došlo je do pogreške prilikom unosa podataka,pokušajte ponovo';
  57.                 }
  58.                
  59.                
  60.                
  61.             }
  62.            
  63.         }
  64.         else
  65.         {
  66.             header('location:index.php');
  67.         }
  68.        
  69.         ?>
  70.     </body>
  71.     <table>
  72.         <form action="" method="POST">
  73.             <tr><td>Ime:<td><input type="text" name="ime"
  74.                                    value="<?php echo $fetch['imeStud'];?>"><tr>
  75.             <tr><td>Prezime<td><input type="text" name="prezime"
  76.                                    value="<?php echo $fetch['prezStud'];?>"><tr>
  77.             <tr><td><input type="submit" name="submit" value="Izmjeni"><tr>
  78.         </form>
  79.     </table>
  80.    
  81.  
  82. </html>
  83.  
  84.  
Add Comment
Please, Sign In to add comment