고수님들 제발 부탁 드립니다. 왕 초보라서요 도저히 어떻게 하는지 몰라서 이렇게 문의 드립니다.
본문
installation.php 페이지에
일자라는 부분 필드를 만들었습니다.
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['mb_date']; ?>&w=u">
<?php echo $row['wr_date'] ?></a></td>
위와 같이
그리고
install_form.php 페이지에 다음과 같이 적어 주었습니다.
<tr>
<th scope="row"><label for="fm_order">일자</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['wr_date']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
그러나
문제는 작동을 안하다는 것입니다.
입력폼으로 가서 입력을 해도 안 나오고 엑셀 업로드를 해도 안 나아고
혹시 작성 방법이 틀린 건가요
죄송하지만 만약 틀렸다고 하면 소스 코드좀 적어 주심 안될까요
아주아주아주 초보라서요
또한 이것은 PHP로 작성을 해야 하나요
아님 자바 스크립트로 해야 하나요
날자가 2016-11-15 이런 식으로만 나오면 되거든요
좀 알려 주세요
부탁 드려요
이것 만 하면 되는데
이게 마무리가 안 되요
제발 부탁 드립니다.
혹시 몰라서 소스는 다 넣어 두었습니다.
installation.php // 소스 내용
<?php
$sub_menu = '400900';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$year = date("Y");
$mon1 = $year."-".$mon."-31 23:59:59";
$mon2 = $year."-".$mon."-01 00:00:00";
if($mon){
$sql_mon = " where '{$mon1}' > regdate and '{$mon2}' < regdate ";
}
$g5['title'] = '설치관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$sql_common = " from g5_installation where (1) ";
if($stx) {
$sql_common .= " and ".$sfl." LIKE '%".$stx."%' ";
}
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_mon. "". $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = "select * $sql_common $sql_mon order by idx desc limit $from_record, {$config['cf_page_rows']} ";
$result = sql_query($sql);
//echo $sql."/sql<br>";
?>
<div class="local_ov01 local_ov">
<?php if ($page > 1) {?><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>">처음으로</a><?php } ?>
<span>전체 <?php echo $total_count; ?>건</span>
</div>
<div class="local_desc01 local_desc">
<ol>
<li>엑셀파일 업로드방법</li>
<li>오른쪽 링크파일을 다운로드 받아 엑셀로 파일열기를 합니다. => <b><a href='http://pcholic.co.kr/sample1.zip'>클릭</a></b></li>
<li>관련내용들을 기록후 저장시, <strong>txt(탭으로 분리)</strong> 로 저장합니다.</li>
<li>저장후 저장한 파일을 더블클릭후 내용모두를 오른쪽 링크파일안에 붙혀넣기를 합니다. =><b><a href='http://pcholic.co.kr/sample2.zip'>클릭</a></b></li>
<li>저장후 업로드하면 되고, 불필요한 라인들은 삭제합니다.</li>
</ol>
</div>
<div class="btn_add01 btn_add">
<span style="float:left;">
<input type="button" id="<?=$i?>" name="<?=$i?>" value="전체보기" onclick="location.href='/adm/shop_admin/installation.php'">
<? for($i=1;$i<13;$i++){?>
<input type="button" id="<?=$i?>" name="<?=$i?>" value="<?=$i?>월" onclick="location.href='/adm/shop_admin/installation.php?mon=<?=$i?>'">
<?}?>
</span>
<a href="./install_form.php">설치추가</a>
</div>
<form name="forderprint" action="./excel_upload.php" method='post' enctype='multipart/form-data'>
<table width="100%">
<tr>
<td width="110" class="pad_t10">엑셀파일<br />업로드<b>(*.txt)</b></td>
<td>
<input type="file" name="fr_od_id" size="30" maxlength="10" class="ed"><br />
<b>엑셀 확장자를 txt(탭으로 분리)로 저장 후 업로드</b>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="btn1" value="엑셀파일 업로드"></td>
</tr>
</table>
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col" width="2%">번호</th>
<th scope="col" width="3%">일자</th>
<th scope="col" width="6%">모델명</th>
<th scope="col" width="5%">이름</th>
<th scope="col" width="5%">담당기사</th>
<th scope="col" width="4%">전화번호</th>
<th scope="col" width="20%">주소</th>
<th scope="col" width="5%">설치유형</th>
<th scope="col" width="4%">처리사항</th>
<th scope="col" width="2%">삭제</th>
</tr>
</thead>
<tbody>
<?php for ($i=0; $row=sql_fetch_array($result); $i++) {
$sql1 = " select COUNT(*) as cnt from {$g5['faq_table']} where fm_id = '{$row['fm_id']}' ";
$row1 = sql_fetch($sql1);
$cnt = $row1['cnt'];
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $row['idx']; ?></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['mb_date']; ?>&w=u">
<?php echo $row['wr_date'] ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['model']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['name']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['enginieer']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['tel']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['addr']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['type']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['proc']; ?></a></td>
<td class="td_mng">
<a href="./install_form_update.php?idx=<?=$row['idx']?>&w=d"><span class="sound_only"> </span>삭제</a>
</td>
</tr>
<?php
}
if ($i == 0){
echo '<tr><td colspan="100" class="empty_table"><span>자료가 한건도 없습니다.</span></td></tr>';
}
?>
</tbody>
</table>
</div>
<!--검색박스 시작-->
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="<?=$i?>">
<option value="model">모델명</option>
<option value="name">이름</option>
<option value="enginieer">담당기사</option>
<option value="addr">주소</option>
<option value="type">설치유형</option>
<option value="proc">처리사항</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="" id="stx" required class="required frm_input">
<input type="submit" class="btn_submit" value="검색">
</form>
<center>
<script>
function printWindow() {
bv = parseint(navigator.appversion);
if (bv)=4) window.print();
}
var tempBody;
window.onbeforeprint = function() {
tempBody = document.body.innerHTML;
document.body.innerHTML = pri.innerHTML;
}
window.onafterprint = function() {
document.body.innerHTML = tempBody;
}
</script>
<body>
<!--
인쇄영역 숨김
<div id="pri"> 인쇄할영역 </div>
비인쇄할영역<br />
<a href="javascrpt:printWindow();">인쇄하기</a>
-->
<a href="#" onclick="javascript:print();">인쇄하기</a>
</body>
<!--검색박스 끝-->
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>
install_form.php // 폼 소스
<?php
$sub_menu = '400900';
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
auth_check($auth[$sub_menu], "w");
$html_title = '설치';
if ($w == "u")
{
$html_title .= ' 수정';
$readonly = ' readonly';
$sql = " select * from g5_installation where idx = '$idx' ";
$il = sql_fetch($sql);
if (!$il['idx']) alert('등록된 자료가 없습니다.');
}
else
{
$html_title .= ' 입력';
}
$g5['title'] = $html_title.' 관리';
//수량(재고)
if (!$it_id_cnt){
$cnt = $il[count];
}else{
$sql_cnt = "select *
from g5_shop_item a ,
g5_shop_category b
where (a.ca_id = b.ca_id) and a.it_name = '{$it_id_cnt}'
order by a.pt_num desc, it_name asc
";
$res_cnt = sql_fetch($sql_cnt);
$cnt = $res_cnt[it_stock_qty];
}
include_once (G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="frmfaqmasterform" action="./install_form_update.php" onsubmit="return frmfaqmasterform_check(this);" method="post" enctype="MULTIPART/FORM-DATA">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="idx" value="<?php echo $idx; ?>">
<input type="hidden" name="token" value="">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="fm_order">일자</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['wr_date']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">모델명</label></th>
<td>
<select name="model" id="model" onchange="location.href='/adm/shop_admin/install_form.php?it_id_cnt='+this.value+'&idx=<?=$idx?>&w=<?=$w?>'">
<?
$sql = "select *
from g5_shop_item a ,
g5_shop_category b
where (a.ca_id = b.ca_id) and a.ca_id2 = '5020'
order by a.pt_num desc, it_name asc
";
$result = sql_query($sql);
for ($i=0; $row2=sql_fetch_array($result); $i++) {
?>
<option value="<?=$row2[it_name]?>"
<? if($it_id_cnt){?>
<? if($row2[it_name]==$it_id_cnt){?>selected<?}?>
<? }else{?>
<? if($row2[it_name]==$il[model]){?>selected<?}?>
<? }?>
><?=$row2[it_name]?></option>
<? }?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">수량(재고)</label></th>
<td>
<input type="text" name="cnt" value="<?php echo $cnt; ?>" id="cnt" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">설치비</label></th>
<td>
<input type="text" name="pay" value="<?php echo $il['pay']; ?>" id="pay" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">담당설치기사</label></th>
<td>
<select name="enginieer" id="enginieer">
<?
$sql = "select * from g5_member where mb_level = '5' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
?>
<option value="<?=$row[mb_name]?>/<?=$row[mb_id]?>"
<? if($row[mb_name]==$il[enginieer]){?>selected<?}?>><?=$row[mb_name]?>(<?=$row[mb_nick]?>)</option>
<? }?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">이름</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['name']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">전화번호</label></th>
<td>
<input type="text" name="tel" value="<?php echo $il['tel']; ?>" id="tel" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">주소</label></th>
<td>
<input type="text" name="addr" value="<?php echo $il['addr']; ?>" id="addr" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">설치유형</label></th>
<td>
<select name="type" id="type">
<option value="스탠드형 벽걸이" <? if($il[type]=='스탠드형 벽걸이'){?>selected<?}?>>스탠드형 벽걸이</option>
<option value="고정형 벽걸이" <? if($il[type]=='고정형 벽걸이'){?>selected<?}?>>고정형 벽걸이</option>
<option value="회전형 벽걸이" <? if($il[type]=='회전형 벽걸이'){?>selected<?}?>>회전형 벽걸이</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지1</label></th>
<td>
<input type="file" name="idx_1img" id="idx_1img">
<?php
$himg = G5_DATA_PATH.'/elist/'.$il['idx'].'_1';
if (file_exists($himg)) {
$size = @getimagesize($himg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_1img_del" value="1" id="idx_1img_del"> <label for="idx_1img_del">삭제</label>';
$himg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_1" width="'.$width.'" alt="">';
}
if ($himg_str) {
echo '<div class="banner_or_img">';
echo $himg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지2</label></th>
<td>
<input type="file" name="idx_2img" id="idx_2img">
<?php
$timg = G5_DATA_PATH.'/elist/'.$il['idx'].'_2';
if (file_exists($timg)) {
$size = @getimagesize($timg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_2img_del" value="1" id="idx_2img_del"><label for="idx_2img_del">삭제</label>';
$timg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_2" width="'.$width.'" alt="">';
}
if ($timg_str) {
echo '<div class="banner_or_img">';
echo $timg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지3</label></th>
<td>
<input type="file" name="idx_3img" id="idx_3img">
<?php
$timg = G5_DATA_PATH.'/elist/'.$il['idx'].'_3';
if (file_exists($timg)) {
$size = @getimagesize($timg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_3img_del" value="1" id="idx_3img_del"><label for="idx_3img_del">삭제</label>';
$timg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_3" width="'.$width.'" alt="">';
}
if ($timg_str) {
echo '<div class="banner_or_img">';
echo $timg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">기사에게 전달 기타사항</label></th>
<td>
<textarea id="fm_order" class="frm_input" name="etc_admin" id="etc_admin" rows="3"><?=$il[etc_admin]?></textarea>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">관리자에게 전달 기타사항</label></th>
<td>
<textarea id="fm_order" class="frm_input" name="etc_admin" id="etc_admin" rows="3"><?=$il[etc_out]?></textarea>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">처리사항</label></th>
<td>
<select name="proc" id="proc">
<option value="설치대기" <? if($il[proc]=='설치대기'){?>selected<?}?>>설치대기</option>
<option value="설치중" <? if($il[type]=='설치중'){?>selected<?}?>>설치중</option>
<option value="설치완료" <? if($il[type]=='설치완료'){?>selected<?}?>>설치완료</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./installation.php">목록</a>
</div>
</form>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>
답변 4
그누보드를 사용하시나요?
그렇다면
$row['mb_date']은 db의 g5_member테이블을 불러온 값인가?
그렇다면 mb_date라는 컬럼은 없고 mb_datetime 컬럼은 있군요.
$row['mb_datetime']으로 바꾸셔야
다른 것들도 mb_datetime으로 바꿔야 가능할 겁니다.
물론 sql_fetch_array를 한 값들이라면 말이죠.
네 그누보드 기반 맞구요
아래 사진 처럼 모델명 왼쪽에 필드를 한개 만들었어요
님이 알려 주신대로 하니 잘 되지 않아요
죄송하지만 아래 코드 처럼 했는데 안되요
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['mb_datetime']; ?>&w=u">
<?php echo $row['mb_datetime'] ?></a></td>
위와 같이
그리고
install_form.php 페이지에 다음과 같이 적어 주었습니다.
<tr>
<th scope="row"><label for="fm_order">일자</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['mb_datetime']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
위 처럼 했는데 여전히 나오지는 않아ㅛ
그러면요
install_from_update.php 이파일도 소스 코드 올려 드립니다,.
이것을 보면 알 수 있나요
<?php
$sub_menu = '400900';
include_once('./_common.php');
if ($w == "u" || $w == "d")
check_demo();
if ($W == 'd')
auth_check($auth[$sub_menu], "d");
else
auth_check($auth[$sub_menu], "w");
//check_admin_token();
@mkdir(G5_DATA_PATH."/elist", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/elist", G5_DIR_PERMISSION);
if ($idx_1img_del) @unlink(G5_DATA_PATH."/elist/{$idx}_1");
if ($idx_2img_del) @unlink(G5_DATA_PATH."/elist/{$idx}_2");
if ($idx_3img_del) @unlink(G5_DATA_PATH."/elist/{$idx}_3");
$enginieer_temp = explode("/",$enginieer);
$enginieer = $enginieer_temp[0];
$mb_id = $enginieer_temp[1];
$sql_common = " set model = '$model',
count = '$cnt',
pay = '$pay',
enginieer = '$enginieer',
mb_id = '$mb_id',
name = '$name',
tel = '$tel',
addr = '$addr',
type = '$type',
etc_admin = '$etc_admin',
proc = '$proc'
";
if ($w == "")
{
//$sql = " alter table g5_insallation auto_increment=1 ";
//sql_query($sql);
$sql = " insert g5_installation $sql_common ";
sql_query($sql);
$idx = sql_insert_id();
}
else if ($w == "u")
{
$sql = " update g5_installation $sql_common where idx = '$idx' ";
sql_query($sql);
}
else if ($w == "d")
{
@unlink(G5_DATA_PATH."/elist/{$idx}_1");
@unlink(G5_DATA_PATH."/elist/{$idx}_2");
@unlink(G5_DATA_PATH."/elist/{$idx}_3");
// FAQ삭제
$sql = " delete from g5_installation where idx = '$idx' ";
sql_query($sql);
// FAQ상세삭제
$sql = " delete from g5_installation where idx = '$idx' ";
sql_query($sql);
}
if ($w == "" || $w == "u")
{
if ($_FILES['idx_1img']['name']){
$dest_path = G5_DATA_PATH."/elist/".$idx."_1";
@move_uploaded_file($_FILES['idx_1img']['tmp_name'], $dest_path);
@chmod($dest_path, G5_FILE_PERMISSION);
}
if ($_FILES['idx_2img']['name']){
$dest_path = G5_DATA_PATH."/elist/".$idx."_2";
@move_uploaded_file($_FILES['idx_2img']['tmp_name'], $dest_path);
@chmod($dest_path, G5_FILE_PERMISSION);
}
if ($_FILES['idx_3img']['name']){
$dest_path = G5_DATA_PATH."/elist/".$idx."_3";
@move_uploaded_file($_FILES['idx_3img']['tmp_name'], $dest_path);
@chmod($dest_path, G5_FILE_PERMISSION);
}
goto_url("./installation.php");
}
else
goto_url("./installation.php");
?>
mb_date, wr_date 이 값은 하나도 없구요
g5_insallation 테이블을 다루는 것은 맞습니다.
하지만 위의 mb_date, wr_date 값은 없습니다.
대신에 regdate 라는 값은 있으며 종류는 timestamp 입니다.
혹시 timestamp 로 가지고서는 날짜를 표현을 못하나요 폼에서 입력을 하고 작성 완료를 눌렀을 때
날자가 일자에 나오게 할 수 있었으면 좋을 것 같은데
죄송합니다. 너무 초보적인 질문만 해서요