<script language='javascript'>
function ChangeCheck(obj)
{
with(obj)
{
var slt1 = elements['mode'].selectedIndex;
var slt2 = elements['mode2'].selectedIndex;
if(slt1==slt2) { alert('두개의 위치가 동일합니다.'); return false;}
submit();
}
}
</script>
<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center'>
<tr>
<td>
<form method='post' action='area_process.php?psMode=CHANGE' name='frm_write' enctype='multipart/form-data' style='border:0;margin:0' onSubmit='return ChangeCheck(this)'>
<?php
if($aFile)
{
echo '<select name="mode" class=input>';
foreach($aFile as $ix => $v)
{
$v = str_replace('|',' ',$v);
echo "<option value=$ix>$v";
}
echo '</select> 와 ';
echo '<select name="mode2" class=input>';
foreach($aFile as $ix => $v)
{
$v = str_replace('|',' ',$v);
echo "<option value=$ix>$v";
}
echo '</select> 의 위치를 ';
}
?>
<input type='submit' value=' 바꾸기 ' class='inputbtn' />
</form>
</td>
</tr>
</table>
---------------------------------------------------------- process
<?php
case( 'CHANGE' ):
extract($_POST);
$aArea = file('./data/area.cgi');
$first = $aArea[$mode];
$last = $aArea[$mode2];
for($i=0; $i<count($aArea); ++$i)
{
if($mode == $i)
{
$aArea[$i] = $last;
}
else if($mode2 == $i)
{
$aArea[$i] = $first;
}
}
// $objCommon->printR($aArea);
// exit;
$fp = fopen("./data/area.cgi", w);
foreach($aArea as $index => $value)
{
if($_GET[no]!=$index) fwrite($fp, $value);
}
fclose($fp);
$objCommon->go("./{$sPage}_list.php");
break;
function ChangeCheck(obj)
{
with(obj)
{
var slt1 = elements['mode'].selectedIndex;
var slt2 = elements['mode2'].selectedIndex;
if(slt1==slt2) { alert('두개의 위치가 동일합니다.'); return false;}
submit();
}
}
</script>
<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center'>
<tr>
<td>
<form method='post' action='area_process.php?psMode=CHANGE' name='frm_write' enctype='multipart/form-data' style='border:0;margin:0' onSubmit='return ChangeCheck(this)'>
<?php
if($aFile)
{
echo '<select name="mode" class=input>';
foreach($aFile as $ix => $v)
{
$v = str_replace('|',' ',$v);
echo "<option value=$ix>$v";
}
echo '</select> 와 ';
echo '<select name="mode2" class=input>';
foreach($aFile as $ix => $v)
{
$v = str_replace('|',' ',$v);
echo "<option value=$ix>$v";
}
echo '</select> 의 위치를 ';
}
?>
<input type='submit' value=' 바꾸기 ' class='inputbtn' />
</form>
</td>
</tr>
</table>
---------------------------------------------------------- process
<?php
case( 'CHANGE' ):
extract($_POST);
$aArea = file('./data/area.cgi');
$first = $aArea[$mode];
$last = $aArea[$mode2];
for($i=0; $i<count($aArea); ++$i)
{
if($mode == $i)
{
$aArea[$i] = $last;
}
else if($mode2 == $i)
{
$aArea[$i] = $first;
}
}
// $objCommon->printR($aArea);
// exit;
$fp = fopen("./data/area.cgi", w);
foreach($aArea as $index => $value)
{
if($_GET[no]!=$index) fwrite($fp, $value);
}
fclose($fp);
$objCommon->go("./{$sPage}_list.php");
break;
'Web > PHP' 카테고리의 다른 글
파일 용량 제한 풀기 upload_max_filesize (0) | 2013.09.26 |
---|---|
환경 변수 얻는 방법 (0) | 2013.09.26 |
구문강조 (0) | 2013.09.26 |
text2png: 순수 php만으로 구현한 png 생성 소스 (0) | 2013.09.26 |
1970년 이전 날짜 사용가능한 date, mktime 조회수:429 (0) | 2013.09.26 |