사용자 도구

사이트 도구


playground:playground
[공지]회원 가입 방법
[공지]글 작성 및 수정 방법

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
playground:playground [2022/01/24] 정승환playground:playground [2022/10/22] (현재) 정승환
줄 1: 줄 1:
 ======연습장====== ======연습장======
- 
-<html> 
-    <head> 
-        <meta charset="utf-8"> 
-        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
-        <title>계산기</title> 
-        <meta name="description" content=""> 
-        <meta name="viewport" content="width=device-width"> 
-    </head> 
-    <body> 
-        <form method="post"> 
-            <input type="text" name="id" id="id"/> 
-            <select name="by_" id="by_"> 
-            <option>+</option> 
-            <option>-</option> 
-            <option>/</option> 
-            <option>*</option> 
-            </select> 
-            <input type="text" name="id2" id="id2"/> 
-            <input type="submit" value="계산하기"> 
-        </form> 
-    </body> 
-</html> 
- 
- 
-<html> 
- <head> 
- <title>Calculator</title> 
- <meta charset="utf-8"> 
- <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
- <meta name="viewport" content="width=device-width, initial-scale=1"> 
-   
- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> 
- </head> 
- <body> 
-  
- <div class="container" style="margin-top: 50px"> 
-  
- <?php 
-  
- // If the submit button has been pressed 
- if(isset($_POST['submit'])) 
- { 
- // Check number values 
- if(is_numeric($_POST['number1']) && is_numeric($_POST['number2'])) 
- { 
- // Calculate total 
- if($_POST['operation'] == 'plus') 
- { 
- $total = $_POST['number1'] + $_POST['number2'];  
- } 
- if($_POST['operation'] == 'minus') 
- { 
- $total = $_POST['number1'] - $_POST['number2'];  
- } 
- if($_POST['operation'] == 'times') 
- { 
- $total = $_POST['number1'] * $_POST['number2'];  
- } 
- if($_POST['operation'] == 'divided by') 
- { 
- $total = $_POST['number1'] / $_POST['number2'];  
- } 
-  
- // Print total to the browser 
- echo "<h1>{$_POST['number1']} {$_POST['operation']} {$_POST['number2']} equals {$total}</h1>"; 
-  
- } else { 
-  
- // Print error message to the browser 
- echo 'Numeric values are required'; 
-  
- } 
- } 
-  
- ?> 
-      
-     <!-- Calculator form --> 
-     <form method="post" action="calculator.php"> 
-         <input name="number1" type="text" class="form-control" style="width: 150px; display: inline" /> 
-         <select name="operation"> 
-         <option value="plus">Plus</option> 
-             <option value="minus">Minus</option> 
-             <option value="times">Times</option> 
-             <option value="divided by">Divided By</option> 
-         </select> 
-         <input name="number2" type="text" class="form-control" style="width: 150px; display: inline" /> 
-         <input name="submit" type="submit" value="Calculate" class="btn btn-primary" /> 
-     </form> 
-      
- </div> 
-  
- </body> 
-</html> 
- 
  

[홈레코딩 필독서]"모두의 홈레코딩"구매링크


playground/playground.1643012160.txt.gz · 마지막으로 수정됨: 2022/01/24 저자 정승환