0
나는 아래의 이미지를 클릭하여 위의 체크 박스를 클릭 할 수있는 기능을 추가하고 싶습니다. 가능합니까? 29-32 줄로 보입니다. 예를 발견했지만 저를 위해 일하지 않았습니다.자바 스크립트 체크 박스 (클릭 이미지 - 체크 박스)
감사
<html>
<head>
<title>This is a simple PHP script to delete select images.</title>
</head>
<body>
<?php
if (isset($_POST['image_list'])) {
foreach ($_POST['image_list'] as $imagename) {
if (file_exists($imagename)) {
unlink($imagename);
}
}
}
?>
<form action="images_view.php" method="POST">
<p>Please select multiple images you want to remove. Please note that the selected images will be removed from server as well.</p>
<?php
$files = glob("videos/THUMBNAILS/*.*");
for ($i=0; $i<count($files); $i++)
{
$image = $files[$i];
$supported_file = array(
'jpg',
);
$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
if (in_array($ext, $supported_file)) {
echo '<input type="checkbox" name="image_list[]" style="margin-right:10px;" value="'.$image.'" />';
echo '<input type="checkbox" name="image_list[]" style="margin-right:10px;" value="'.$image.'" />';
echo basename($image)."<br />"; // show only image name if you want to show full path then use this code // echo $image."<br />";
echo '<img src="'.$image .'" style="max-width: calc(100% - 20px); alt="Random image" />'."<br /><br />";
} else {
continue;
}
}
?>
<input type="submit" name="submit" style="width:300px;height:60px;margin-left:20px;" value="Delete" />
</form>
</body>
</html>
체크 표시가 선택된 이미지를 클릭하면 다음 코드가 작동하지만 "삭제"기능이 작동하지 않습니다. –