파일1, 파일2, .... 이와같이 반복문으로 번호가 나옵니다.
본문
아래의 첨부파일에서
파일1, 파일2, .... 이와같이 반복문으로 번호가 나옵니다.
파일1, 파일2, ... 이 부분을 aaa, bbb, ccc ... 이와같이 특정이름을 넣으려면
어떻게 해야하나요. 감사합니다.
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td colspan="3">
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<?php } ?>
<?php if($w == 'u' && $file[$i]['file']) { ?>
<input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i; ?>]" value="1"> <label for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'].'('.$file[$i]['size'].')'; ?> 파일 삭제</label>
<?php } ?>
</td>
</tr>
<?php } ?>
답변 2
for 문으로 $i 값을 파일 1,2,3 이런식으로 출력되기때문에
<?php for ($i=0; $is_file && $i<$file_count; $i++) {
$file_txt = "";
if($i == 0)$file_txt = "aaa";
if($i == 1)$file_txt = "bbb";
if($i == 2)$file_txt = "ccc";
if($i == 3)$file_txt = "ddd";
?>
<tr>
<th scope="row"><?php echo $file_txt?></th>
이런식으로 텍스트를 변경 가능합니다.
아이티몬스님, 답변 감사합니다.