-
Notifications
You must be signed in to change notification settings - Fork 0
/
editP.php
87 lines (73 loc) · 2.3 KB
/
editP.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
//require_once "php/connFile.php";
//require_once "php/sessionManager.php";
// Check for valid session and obtaiun userid
$userid = sessionToUID(getUserCookie(), getSessionCookie());
if ($userid === (-1)){
// If invalid user session return here
include "login.php";
return;
} else {
echo '
<h2>Upravljanje vašim postojećim proizvodima</h2>
<p>Na ovoj stranici možete pregledati svoje postojeće proizvode, obrisati ih ili
izmjeniti informacije o istima.</p>
<h3>Lista proizvoda</h3>
<div id="subcont_prodlist">
';
}
// Get product information from database for products owned by this user
$stmt = $conHandle->prepare("SELECT id, naziv FROM proizvodi WHERE userid = ?") or die("Error binding");
$stmt->bind_param("i", $userid);
$stmt->execute();
$stmt->bind_result($id, $nazivP);
$count = 0;
while($stmt->fetch())
{
echo '
<div id="subcont_p'.$id.'" class="subcont_proizvodi" onclick="fetchPdata('."'".$id."'".',this)">
'.$nazivP.'
</div>
';
$count++;
}
if ($count === 0) {
echo '
<div class="subcont_proizvodi" >
Nemate postavljenih proizvoda, probajte <a class="link_dash" href="?page=addP">dodati novi proizvod</a>
</div>';
}
$stmt->close();
echo '
</div>
<div id="subcont_prodinfo">
<form id="form_editproduct" method="post" action="php/addProd.php" >
<input type="number" name="id" contenteditable="false" hidden="true" value="" />
<table>
<tr>
<td>Naziv<br/>proizvoda*</td>
<td><input required="required" type="text" name="nazivP" placeholder="Naziv"/></td>
</tr>
<tr>
<td>Opis<br/>proizvoda*</td>
<td><textarea required="required" name="opisP" rows="6" cols="50" placeholder="Opis proizvoda, dostupna količina, cijena..."></textarea><br/></td>
</tr>
<tr>
<td>Slika</td>
<td>
<input type="file" name="slikaP" placeholder="Lokacija slike" />
<br/>
<span style="font-size: 12px;">Vaša će slika nakon postavljanja biti smanjena na 300 x 300 px</span>
</td>
</tr>
</table>
<br/>
<br/>
<input type="button" class="button_generic" onclick="submitForm(this.form)" name="dodaj" value="Spremi promjene" />
<br/>
<div id="form_editproduct_status">
</div>
</form>
</div>
';
?>