HTML<html>
<head>
<title>Moja WEB strana</title>
<head>
<body>
<form action = "baza_edit.php" method = "GET">
Ime: <input type = "text" name = "ime" />
Prezime: <input type = "text" name = "prezime" />
Email: <input type = "text" name = "email" />
<input type = "submit" value="smeni"/>
</form>
</body>
</html>
baza_edit.php
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "mojaDB";
// Kreiranje na konekcija
$conn = new mysqli($servername, $username, $password, $dbname);
// Proverka na konekcijata
if ($conn->connect_error) {
die("Nema konekcija " . $conn->connect_error);
}
$tabela="ucenici";
$ime=$_GET['ime'];
$prezime=$_GET['prezime'];
$email=$_GET['email'];
$sql = "UPDATE $tabela SET email='$email',prezime='$prezime' WHERE ime='$ime' ";
if ($conn->query($sql) === TRUE) {
echo "Smeneti podatoci";
} else {
echo "Greska pri smena na podatoci " . $conn->error;
}
$conn->close();
?>