-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduzenle.php
84 lines (68 loc) · 1.72 KB
/
duzenle.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
<?php
require "baglan.php";
$id = $_GET["id"];
if(isset($_POST["ad"])){
$guncelle = $db->prepare("UPDATE kisiler SET yas = ?, cinsiyet = ?, ad = ?, soyad = ?, il = ? WHERE id = ?");
$guncelle->execute(
array(
$_POST["yas"],
$_POST["cinsiyet"],
$_POST["ad"],
$_POST["soyad"],
$_POST["sehir"],
$id
)
);
$hatalar = $guncelle->errorInfo();
if(empty($hatalar[2])){
echo "başarıyla güncellendi";
}else{
echo "hatan var! $hatalar[2]";
}
}
$sorgu = $db->prepare("Select * from kisiler WHERE id = ? ");
$sorgu->execute(array($id));
$bilgi = $sorgu->fetch();
?>
<form action="duzenle.php?id=<?php echo $id; ?>" method="post">
Ad : <input type="text" name="ad" value="<?php echo $bilgi["ad"]; ?>" /><br />
Soyad : <input type="text" name="soyad" value="<?php echo $bilgi["soyad"]; ?>" /><br />
Yas <input type="number" name="yas" value="<?php echo $bilgi["yas"]; ?>" /><br />
Cinsiyet <br />
<?php
if($bilgi["cinsiyet"]=="erkek"){
$erkek = "checked";
$kadin = "";
}else{
$erkek = "";
$kadin = "checked";
}
?>
Kadın <input type="radio" name="cinsiyet" value="kadin" <?php echo $kadin; ?>/>
Erkek <input type="radio" name="cinsiyet" value="erkek" <?php echo $erkek; ?>/><br />
Şehir <br />
<?php
$sorgu2 = $db->prepare("SELECT * FROM iller ORDER BY ilinadi ASC");
$sorgu2->execute();
$iller = $sorgu2->fetchAll();
// var_dump($iller);
?>
<select name="sehir">
<?php
foreach($iller AS $il){
if($bilgi["il"]==$il["id"]){
echo "
<option value='$il[id]' selected>$il[ilinadi]</option>
";
}else{
echo "
<option value='$il[id]'>$il[ilinadi]</option>
";
}
}
?>
</select>
<br />
<br />
<input type="submit" value="formumu gönder" />
</form>