Answer the question
In order to leave comments, you need to log in
How to fix the need to repeatedly click on the back button that occurs when redirecting?
After pressing the delete button in the file with pictures, the code of the delete.php file is executed in which the redirection to the file with pictures takes place.
But at the same time, it becomes necessary to additionally press the chrome back button.
<html>
<head>
<link rel="stylesheet" type="text/css" href="style2.css">
</head>
<body>
<?php
$delet=$_GET[name];
$category=$_GET[category];
$host = 'localhost'; // адрес сервера
$database = 'imagess'; // имя базы данных
$user = 'admin'; // имя пользователя
$password = '12345'; // пароль
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
$res = mysqli_query($link,"SELECT name,showname FROM imagess WHERE category='".$category."'");
?>
<div class="wrap">
<?php
while($row = mysqli_fetch_array($res)) {
$src='upload/'.$row['name'];
?>
<div class="block">
<div style="height:400px;width:450px;overflow:hidden; text-align: center;float:left;background-color:#8c95a3;"class="<?php echo $row['showname']; ?>">
<img style="max-height:400px;" src="<?php echo $src; ?>"/>
</div>
<a href="delete.php?name=<?php echo $row['name'];?>&category=<?php echo $category?>" class="c">Удалить </a>
</div>
<?php
}
?>
</div>
<?php
mysqli_close($link);
?>
</body>
</html>
<?php
header('location:http://localhost/cite/cod.php?category='.$_GET[category]);
$delet=$_GET[name];
$host = 'localhost'; // адрес сервера
$database = 'imagess'; // имя базы данных
$user = 'admin'; // имя пользователя
$password = '12345'; // пароль
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
if ($delet!='')
{
mysqli_query($link,"delete FROM imagess WHERE name='".$delet."'");
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question