You are on page 1of 3

< ?

php

if (isset($_POST['unos']))
{
include('connect-mysql.php');
$ime = $_POST['ime'];
$prezime = $_POST['prezime'];
$indeks = $_POST['indeks'];
if ($ime == "" || $prezime == "" || $indeks == "")
{

}
else
{
mysql_query("INSERT INTO register(ime, prezime, indeks)
VALUES('$ime', '$prezime', '$indeks')");
}

$records = mysql_query("SELECT * FROM register");


$newrecord1 = " $ime $prezime";
$newrecord2 = " je snimljen/a u bazu !";

}
? >

<html id = "html">
<head>
<link rel = "stylesheet" type = "text/css" href = "pohrana_podataka.css"
< / head>
<body>

<fieldset class = "fieldset3">


<H1 id = "naslov">Unos studenata< / H1>
< / fieldset>

<div id = "all">

<form action = "pohrana_podataka.php" method = "post">


<input type = "hidden" name = "unos" value = "true">
<fieldset class = "fieldset2">
<fieldset class = "fieldset1">
<legend><h3>Unos podataka< / h3>< / legend>
Ime:<br / ><input type = "text" name = "ime" ><br / >
<br / >
Prezime : <br / ><input type = "text" name = "prezime"><br / >
<br / >
Broj indeksa : <br / ><input type = "text" name = "indeks"><br / >
<br / >
<input type = "submit" name = "submit" value = "Sačuvaj">
< / fieldset>
< / fieldset>

<fieldset id = "obavijest" align = "center">


< ? php

if ($ime == "" || $prezime == "" || $indeks == "")


{
echo '<html>
<img src = "false.png" alt = "Mountain View" style =
"width:30px;height:30px;">
< / html><br>';
echo "Molimo unesite podatke"."<br>";
echo "o studentu/ci !!!";

}
else
{
echo '<html>
<img src = "true.png" alt = "Mountain View" style =
"width:30px;height:30px;">
< / html><br>';
echo $newrecord1."<br>";
echo $newrecord2."<br>";

? >
< / fieldset>

< / form>
<div class = "div"><fieldset class = "fieldset4">

< ? php if ($ime == "Ime" && $prezime == "Prezime" || $ime == "ime" && $prezime ==
"prezime" || $ime == "IME" && $prezime == "PREZIME")
{
echo '<html>
<img src = "osoba.jpg" alt = "Mountain View" style =
"width:304px;height:228px;">
< / html><br>';
}
else
{
echo '<html>
<img src = "student.png" alt = "Mountain View" style =
"width:304px;height:228px;">
< / html><br>';

} ? >
< / fieldset>< / div>

<div>
<table id = "tabela1" border = "1">
<tr class = "celija">
<th class = "celija1">ID< / th>
<th class = "celija2">Ime< / th>
<th class = "celija2">Prezime< / th>
<th class = "celija3">Broj indeksa< / th>
< / tr>
< ? php

while ($podaci = mysql_fetch_assoc($records)) {


echo "<tr>";
echo "<th>".$podaci['id']."</th>";
echo "<td>".$podaci['ime']."</td>";
echo "<td>".$podaci['prezime']."</td>";
echo "<th>".$podaci['indeks']."</th>";
echo "<tr>";
}

? >
< / table>
< / div>
< / div>

< / body>
< / html>

You might also like