<html>
<head>
<title>지금, 시작합니다</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.input_text{padding-left:3px;}
</style>
<script type="text/javascript">
<!--
function Del()
{
document.getElementsByName("szHour").value = '';
document.getElementsByName("szMinute").value = '';
document.getElementsByName("szSecond").value = '';
}
//-->
</script>
</head>
<body>
<?
/************** 입력한 값을 받아옵니다! **************/
$szHour = ($_POST['szHour']);
$szMinute = ($_POST['szMinute']);
$szSecond = ($_POST['szSecond']);
/************** 시분초 ==> 초 **************/
$szHour = $szHour * 3600;
$szMinute = $szMinute * 60;
$szTime = $szHour + $szMinute + $szSecond;
/************** 초 ==> 시분초 **************/
$days = floor($szTime/86400); // 1일은 86400초, 1시간은 3600초, 1분은 60초
$time = $szTime - ($days*86400); //
$hours = floor($szTime/3600); // 시간
$time = $time - ($hours*3600); //
$minute = floor($time/60); // 분
$second = $time - ($minute*60); // 초
?>
<form name="TestFrm" id="TestFrm" onsubmit="" method="post" action="<? echo $_SERVER['PHP_SELF']; ?>"><!-- $_SERVER['PHP_SELF'] <<== 다시 자신의 페이지로 값을 보낸다 -->
<table width="400" border="1" cellspacing="0" cellpadding="0" valign="center" >
<tr height="30"><td align="center" colspan="2">지금, 시작합니다
</td></tr>
<tr height="30" >
<td width="40%" align="center">시분초</td>
<td align="left" class="input_text">
<input type="text" name="szHour" id="szHour" maxlength="2" size="2" value="" style="text-align:right;">시간
<input type="text" name="szMinute" id="szMinute" maxlength="2" size="2" value="" style="text-align:right;">분
<input type="text" name="szSecond" id="szSecond" maxlength="2" size="2" value="" style="text-align:right;">초
</td>
</tr>
<tr height="30" >
<td align="center">시분초 ==> 초</td>
<td> <? echo $szTime; ?></td>
</tr>
<tr height="30" >
<td align="center">초 ==> 시분초</td>
<td> <? echo $hours; ?>시간 <? echo $minute; ?>분 <? echo $second; ?>초</td>
</tr>
<tr height="30">
<td align="center" colspan="2">
<input type="submit" value="GoGO">
<input type="reset" value="다시작성" src="" onClick="javascript:del();">
</td>
</tr>
</table>
</form>
</body>
</html>
'Web > php . html' 카테고리의 다른 글
1. 라라벨 5 설치 - laravel 5.5 (0) | 2017.09.12 |
---|---|
[php함수] 간단한 msyql 셀렉트 함수만들기 (0) | 2015.02.11 |
버튼으로 열고, 닫는! 간단한 레이어팝업! (0) | 2014.02.20 |
[iframe][빽단]간단한 iframe 사용! (0) | 2014.02.17 |