merhaba arkadaşlar iki resim alanım var birini ekleyince diğer resim kayboluyor yani boş veri güncelliyor ikisine bir resim eklersem sorun yok;
bu problemi nasıl çözerim
image.php
<form action="../netting/islem.php" method="POST" id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" enctype="multipart/form-data">
<div class="form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">İmage Adı<span class="">*</span>
</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<input type="text" id="image_adi" name="image_adi" value="<?php echo $imagecek['image_adi']; ?>" class="form-control col-md-7 col-xs-12">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name"><span class=""></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">Video Resmi<span class=""></span>
</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<?php
if (strlen($imagecek['image1'])>0) {?>
<img width="150" src="../../<?php echo $imagecek['image1']; ?>">
<?php } else {?>
<img width="150" src="../../dimg/kullanici-resim-yok.jpg">
<?php } ?>
<input type="file" id="image1" name="image1" value="<?php echo $imagecek['image1']; ?>" class="form-control col-md-7 col-xs-12">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">Video Resmi<span class=""></span>
</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<?php
if (strlen($imagecek['image2'])>0) {?>
<img width="150" src="../../<?php echo $imagecek['image2']; ?>">
<?php } else {?>
<img width="150" src="../../dimg/kullanici-resim-yok.jpg">
<?php } ?>
<input type="file" id="image2" name="image2" value="<?php echo $imagecek['image2']; ?>" class="form-control col-md-7 col-xs-12">
</div>
</div>
<div align="right" class="col-md-9 col-sm-9 col-xs-12 col-md-offset-3">
<button type="submit" name="imagekaydet" class="btn btn-primary">Güncelle</button>
</div>
</form>islem.php
if (isset($_POST['imagekaydet'])) {
if (!empty($_FILES['image1'])) {
$uploads_dir1 = 'images/';
$tmp_name1 = $_FILES['image1']["tmp_name"];
$name1 = $_FILES['image1']["name"];
$refimgyol1=substr($uploads_dir1, 6)."images/".$name1;
move_uploaded_file($tmp_name1, "$uploads_dir1/$name1");
$image1kaydet=$db->prepare("UPDATE image SET
image_adi=:image_adi,
image1=:image1
WHERE image_id=1");
$update=$image1kaydet->execute(array(
'image_adi' => $_POST['image_adi'],
'image1' => $refimgyol1
));
}
if ($update) {
Header("Location:../production/image.php?durum=ok");
} else {
Header("Location:../production/image.php?durum=no");
}
if (!empty($_FILES['image2'])) {
$uploads_dir2 = 'images/';
$tmp_name2 = $_FILES['image2']["tmp_name"];
$name2 = $_FILES['image2']["name"];
$refimgyol2=substr($uploads_dir2, 6)."images/".$name2;
move_uploaded_file($tmp_name2, "$uploads_dir2/$name2");
$image2kaydet=$db->prepare("UPDATE image SET
image_adi=:image_adi,
image2=:image2
WHERE image_id=1");
$update=$image2kaydet->execute(array(
'image_adi' => $_POST['image_adi'],
'image2' => $refimgyol2
));
}
if ($update) {
Header("Location:../production/image.php?durum=ok");
} else {
Header("Location:../production/image.php?durum=no");
}
}