Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- class model
- {
- function pohranaPodataka()
- {
- require 'konekcija.php';
- if(isset($_GET['mbr']))
- {
- $mbr=$_GET['mbr'];
- $broj=$_GET['broj'];
- $query="select imeStud,prezStud,mbrStud
- from stud
- where mbrStud=$mbr";
- $result=mysqli_query($link,$query);
- $fetch=mysqli_fetch_assoc($result);
- }
- if(isset($_POST['submit']))
- {
- $izvrseno='da';
- $ime=$_POST['ime'];
- $prezime=$_POST['prezime'];
- $query2="UPDATE stud SET imeStud='$ime',"
- . " prezStud = '$prezime' WHERE stud.mbrStud =$mbr";
- $result2=mysqli_query($link,$query2);
- }
- else
- {
- $izvrseno='ne';
- }
- $podaci=array('fetch'=>$fetch,
- 'izvrseno'=>$izvrseno,
- 'broj'=>$broj,
- 'mbr'=>$mbr);
- return $podaci;
- }
- }
- class view
- {
- function ispisPodataka($podaci)
- {
- if($podaci['izvrseno']=='da')
- {
- echo 'Unos podataka izvršen'.'<br>';
- echo '<a href="index.php?mbr='.$podaci['mbr'].'&broj='.$podaci['broj'].'">'.'Vidi Promjene'.'</a>';
- }
- else
- {
- echo '<table border="0">'.
- '<form action="" method="POST">'.
- '<tr><td>'.'Ime '.'<td>'.'<input type="text" name="ime" value="'.$podaci['fetch']['imeStud'].'">'.'<tr>'.
- '<tr><td>'.'Prezime'.'<td>'.'<input type="text" name="prezime" value="'.$podaci['fetch']['prezStud'].'">'.'<tr>'.
- '<tr><td>'.'<input type="submit" name="submit" value="Izmjeni">'.'<tr>'.
- '</form>'.
- '</table>';
- }
- }
- }
- class controler
- {
- public $_Model;
- public $_View;
- function __construct()
- {
- $this->_Model=new model();
- $this->_View=new view();
- }
- function start()
- {
- $podaci= $this->_Model->pohranaPodataka();
- $this->_View->ispisPodataka($podaci);
- }
- }
- $pokreni=new controler();
- $pokreni->start();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement