Notes
![]() ![]() Notes - notes.io |
if(isset($_POST['kayt'], $_POST['name'], $_POST['descp'], $_POST['mark'])){
$name2 = trim(filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING));
$descp = trim(filter_input(INPUT_POST, 'descp', FILTER_SANITIZE_STRING));
$mark = trim(filter_input(INPUT_POST, 'mark', FILTER_SANITIZE_STRING));
$img = $_SESSION['resim'];
$idess = $_SESSION['were'];
if (empty($name2) || empty($descp) || empty($mark)) {
echo "<script>Swal.fire({icon: 'error',
title: 'Oops...',
text: 'Lütfen eksiksiz doldurunuz!',
})</script>";
header("Refresh:2");
}else{
if ($baglanti->query("UPDATE categories SET name = $name2, description = $descp, image = $img, main_category = $mark WHERE id = $idess"))
{
echo "<script>Swal.fire({icon: 'success',
title: 'Oops...',
text: 'Başarılı!',
footer: ''
})</script>";
}else{
die("<script>Swal.fire({icon: 'error',
title: 'Oops...',
text: 'hata!',
footer: ''
})</script>");
}
}
}
if(empty($_GET['cd'])){}else{
$veb = $_GET['cd'];
$silen = $baglanti->query("DELETE FROM categories WHERE id =$veb");
if($silen){
echo "<script>Swal.fire({icon: 'success',
title: 'Oops...',
text: 'Başarılı!',
footer: ''
})</script>";
}else{
echo "<script>Swal.fire({icon: 'error',
title: 'Oops...',
text: 'hata!',
footer: ''
})</script>";
}
}
?>
<script>$(document).ready(function () {
$('#example').DataTable();
});</script>
<!-- Blank Start -->
<div class="container-fluid pt-4 px-4">
<div class="row vh-100 bg-secondary rounded align-items-center justify-content-center mx-0">
<div class="bg-secondary rounded h-100 p-4">
<h6 class="mb-4">Kategoriler</h6>
<div class="table-responsive">
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Kategori Adı</th>
<th scope="col">Açıklama</th>
<th scope="col">Resim</th>
<th scope="col">Ana Kategori</th>
<th scope="col">İşlem</th>
</tr>
</thead>
<tbody>
<?php
if(empty($_GET['ch'])){
$categories2 = $baglanti->query("SELECT * FROM categories");
while($care = $categories2->fetch_assoc()){
$ids = $care['id'];
$descp = $care['description'];
?>
<tr>
<th scope="row"><? echo $care['id']; ?></th>
<td><? echo $care['name']; ?></td>
<td ><? echo kisalt($descp, 5);
?></td>
<td><img width="50" height="50" src="<? echo $care['image']; ?>"></td>
<?php
$categories23 = $baglanti->query("SELECT * FROM categories where id ='$ids'");
while($care2 = $categories23->fetch_assoc()){ ?>
<td><?php echo $care2['name']; ?></td>
<? } ?>
<td> <a href="?cd=<?php echo $ids; ?>" style="color:red">sil</a> <a href="?ch=<?php echo $ids; ?>" style="color:orange">Düzenle</a>
</td>
<?php } ?>
</tr>
<? }else{
$gid = $_GET{'ch'};
$catecek = $baglanti->query("SELECT * FROM categories WHERE id='$gid'");
$ayar = $catecek->fetch_assoc();
if(empty($ayar['id'])){
echo "<h3>Böyle Bir Ürün Bulunamadı</h3>";
}else{
?>
<tr>
<form method="post">
<td><?php echo $gid; ?></td>
<td><input class="btn btn-dark" name="name" value="<?php echo $ayar['name']?>"></td>
<td><textarea class="btn btn-dark" name="descp"><?php echo $ayar['description']?></textarea>
<td><img width="50" height="50" src="<?php echo $ayar['image']?>"></td>
<?php
$_SESSION['resim'] = $ayar['image'];
$_SESSION['were'] = $gid;
?>
<td>
<select class="btn btn-dark" name="mark">
<?php $categories1 = $baglanti->query("SELECT * FROM categories");
while($marka = $categories1->fetch_assoc()){
?>
<option value="<?php echo $marka['id']?>"><?php echo $marka['name']?></option>
<?php } ?>
</select>
</td>
<td><button type="submit" name="kayt" class="btn btn-success" >Kaydet</button></td>
</form>
</tr>
<?php
}
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<br><br><br><br><br><br><br><br><br>
<!-- Blank End -->
<?php include "footer.php"; ?>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team