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

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

팁앤테크

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

페이지 정보

profile_image
작성자 제로
댓글 0건 조회 80,022회 작성일 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 779건 11 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 날짜
529 제로 62079 06-02
528 제로 57743 04-20
527 제로 64949 04-11
526 제로 59392 03-14
525 제로 76280 02-13
열람중 제로 80023 02-09
523 제로 79256 02-08
522 제로 67515 02-08
521 제로 70372 01-31
520 제로 75808 01-28
519 제로 83877 01-27
518 제로 59712 01-26
517 제로 61750 01-24
516 제로 68546 01-24
515 제로 67250 01-24
514 제로 78219 01-24
513 제로 70996 01-24
512 제로 59582 01-23
511 제로 81819 01-15
510 제로 83903 01-15
509 제로 62375 01-10
508 제로 64314 01-04
507 제로 66677 12-27
506 제로 83095 12-14
505 제로 64503 12-10

검색

회원로그인

회원가입

사이트 정보

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

접속자집계

오늘
24,654
어제
11,101
최대
431,155
전체
6,724,694
Copyright (c) 株式会社YHPLUS. All rights reserved.