[php] 전체선택(체크박스) > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[php] 전체선택(체크박스)

페이지 정보

profile_image
작성자 제로
댓글 0건 조회 90,877회 작성일 12-02-09 12:13

본문

----list.php-----------------
<?
include ("./db_conn.inc");
$qry="select * from board";
$result=mysql_query($qry);
?>
<html>
<head>
<title>admin</title>
<script>
function allcheck(form1)
{
for( var i=0; i<form1.elements.length; i++) {
var check = form1.elements[i];

check.checked = true;
}
return;
}
function uncheck(form1)
{
for( var i=0; i<form1.elements.length; i++) {
var check = form1.elements[i];
check.checked = false;
}
return;
}
</script>
</head>
<body>
<center>
<h4>글삭제</h4>
<form name=form1 action="del.php" method="post">
<table border="1" cellpadding="0" cellspacing="0" width="700">
<tr>
<td align="center">선택
</td>
<td align="center">작성일
</td>
<td align="center">글번호
</td>
<td align="center">이름
</td>
<td align="center">제목
</td>
<td align="center">조회수
</td>
</tr>
<?
while($row = mysql_fetch_object($result)) {
$key = $row->no;
echo "<tr>
  <td align='center'><input type='checkbox' name='check[]' value='$key'>
  </td>
  <td align='center'>$row->date
  </td>
  <td align='center'>$row->no
  </td>
  <td align='center'>$row->name
  </td>
  <td align='center'>$row->title
  </td>
  <td align='right'>$row->see
  </td>
  </tr>";
}
mysql_free_result($result);
?>
</table>
<a href="javascript:allcheck(form1);">전체선택</a>    
<a href="javascript:uncheck(form1);">선택해제</a><br>
<input type='submit' value='선택 삭제'>
</form>
</body>
</html>
</body>
</html>


-----del.php---------
<?
include("./db_conn.inc");
for($i=0;$i<count($check);$i++) {
$qry="delete from board where no='$check[$i]'";
mysql_query($qry);
}
mysql_close();
echo "<FONT face=돋움 color=silver>삭제되었습니다.</font>";
echo "<meta http-equiv='Refresh' content='0; URL=index.html'>";
?>

댓글목록

등록된 댓글이 없습니다.

Total 829건 11 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 날짜
579 제로 79522 06-14
578 제로 65414 06-07
577 제로 70084 06-02
576 제로 67277 04-20
575 제로 74669 04-11
574 제로 67444 03-14
573 제로 86269 02-13
열람중 제로 90878 02-09
571 제로 89012 02-08
570 제로 76851 02-08
569 제로 79691 01-31
568 제로 87149 01-28
567 제로 94062 01-27
566 제로 67113 01-26
565 제로 69663 01-24
564 제로 77991 01-24
563 제로 76284 01-24
562 제로 88709 01-24
561 제로 79799 01-24
560 제로 68506 01-23
559 제로 92695 01-15
558 제로 96692 01-15
557 제로 70348 01-10
556 제로 73371 01-04
555 제로 75251 12-27

검색


사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5470-4714
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
22,292
어제
37,399
최대
552,140
전체
16,165,946
Copyright (c) 株式会社YHPLUS. All rights reserved.