안효원 안효원 2022-01-12
last commit
@e85aaf59df057638d716f3fdf50d3aeb9b7772e5
form_1.php
--- form_1.php
+++ form_1.php
@@ -6,11 +6,21 @@
           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <title>Document</title>
+    <style>
+        #page {margin: 0 auto; background-color: antiquewhite; width: 720px;}
+        h2 {text-align: center;}
+    </style>
 </head>
 <body>
-    <form action="form_1_receive.php" method="post">
-        과일을 입력하세요 : <input type="text" name="fruits">
-        <input type="submit">
-    </form>
+    <div id="page">
+        <h2>Data Send</h2>
+        <hr>
+        <form action="form_1_receive.php" method="get">
+            과일을 입력하세요 : <input type="text" name="fruits"><br>
+            이름을 입력하세요 : <input type="text" name="name"><br>
+            생년월일을 입력하세요 : <input type="text" name="birth"><br>
+            <input type="submit">
+        </form>
+    </div>
 </body>
 </html>
(No newline at end of file)
form_1_receive.php
--- form_1_receive.php
+++ form_1_receive.php
@@ -1,4 +1,8 @@
 <?php
-    $fruits = $_POST["fruits"];
+    $fruits = $_GET["fruits"];
+    $name = $_GET["name"];
+    $birth = $_GET["birth"];
 
-    echo "과일 : " . $fruits;
(No newline at end of file)
+    echo "과일 : " . $fruits . "<br>";
+    echo "이름 : " . $name . "<br>";
+    echo "생년월일 : " . $birth . "<br>";
(No newline at end of file)
 
form_2.php (added)
+++ form_2.php
@@ -0,0 +1,46 @@
+<!doctype html>
+<html lang="kos">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+    <style>
+        * {margin: 0 auto;}
+        #page {background-color: antiquewhite; width: 720px;}
+        table {margin-top: 100px;}
+        .send {text-align: center;}
+        .sendButton {width: 100%; height: 3em;}
+    </style>
+</head>
+<body>
+    <div id="page">
+        <form action="form_2.receive.php" method="get">
+            <table border="1">
+                <tr>
+                    <td><label for="userName">Name : </label></td>
+                    <td><input type="text" name="userName" id="userName"></td>
+                </tr>
+                <tr>
+                    <td><label for="userAge">Age : </label></td>
+                    <td><input type="text" name="userAge" id="userAge"></td>
+                </tr>
+                <tr>
+                    <td><label for="userArea">Area : </label></td>
+                    <td>
+                        <select name="userArea" id="userArea">
+                            <option value="seoul">seoul</option>
+                            <option value="gwangju">gwangju</option>
+                            <option value="busan">busan</option>
+                        </select>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="send" colspan="2"><input class="sendButton" type="submit" value="Send"></td>
+                </tr>
+            </table>
+        </form>
+    </div>
+</body>
+</html>
 
form_2.receive.php (added)
+++ form_2.receive.php
@@ -0,0 +1,10 @@
+<?php
+
+    $userName = $_GET["userName"];
+    $userAge = $_GET["userAge"];
+    $userArea = $_GET["userArea"];
+
+    echo "My name is <strong>" . $userName . "</strong><br>";
+    echo "My Age is <strong>" . $userAge . "</strong><br>";
+    echo "My Area is <strong>" . $userArea . "</strong><br>";
+
 
form_3.php (added)
+++ form_3.php
@@ -0,0 +1,42 @@
+<!doctype html>
+<html lang=ko>
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+    <style>
+        * {margin: 0 auto;}
+        #page {background-color: antiquewhite; width: 720px; text-align: center;}
+        .send {width: 28em;}
+    </style>
+</head>
+<body>
+    <div id="page">
+        <form action="form_3.receive.php" method="post">
+            Name : <input type="text" name="userName" placeholder="enter name here"><br>
+            Password : <input type="password" name="userPw"><br>
+
+            <label><input type="radio" name="fruit" value="apple"> Apple</label>
+            <label><input type="radio" name="fruit" value="orange"> Orange</label>
+            <label><input type="radio" name="fruit" value="kiwi"> Kiwi</label>
+            <label><input type="radio" name="fruit" value="peach"> Peach</label><br>
+            
+            <label><input type="checkbox" name="fruits[]" value="apple"> Apple</label>
+            <label><input type="checkbox" name="fruits[]" value="orange"> Orange</label>
+            <label><input type="checkbox" name="fruits[]" value="kiwi"> Kiwi</label>
+            <label><input type="checkbox" name="fruits[]" value="peach"> Peach</label><br>
+
+            <input type="date" name="date"><br>
+
+            <textarea name="text" placeholder="Write Anything" cols="50" rows="10"></textarea><br>
+
+            <input type="hidden" name="hiddenValue" value="InvisibleValue">
+
+            <!-- <input class="send" type="submit" value="Send"> -->
+            <button type="submit" class="send">Send</button>
+        </form>
+    </div>
+</body>
+</html>(No newline at end of file)
 
form_3.receive.php (added)
+++ form_3.receive.php
@@ -0,0 +1,37 @@
+<?php
+
+    $name = $_POST["userName"];
+    $pw = $_POST["userPw"];
+    $fruit = $_POST["fruit"];
+    $fruits = $_POST["fruits"];
+    $date = $_POST["date"];
+    $text = $_POST["text"];
+    $hiddenValue = $_POST["hiddenValue"];
+
+    echo "My name is <strong>" . $name . "</strong><br>";
+    echo "Password is <strong>" . $pw . "</strong><br>";
+    echo "Fruit is <strong>" . $fruit . "</strong><br>";
+
+    /*----------------------for-------------------------*/
+    echo "<hr>";
+    echo "<h3>for</h3>";
+    $fruitsR = $_POST["fruits"];
+    echo "Fruits is <strong>";
+    for($i = 0; $i < count($fruitsR); $i++){
+        echo  $fruitsR[$i] . ", ";
+    }
+    echo "</strong><br>";
+    /*-----------------------foreach------------------------*/
+    echo "<hr>";
+    echo "<h3>foreach</h3>";
+    echo "Fruits is <strong>";
+    foreach ($fruits as $i){
+        print $i . ", ";
+    }
+    echo "</strong><br>";
+    echo "<hr>";
+    /*--------------------------------------------------*/
+
+    echo "Date is <strong>" . $date . "</strong><br>";
+    echo "Text is <strong>" . $text . "</strong><br>";
+    echo "HiddenValue is <strong>" . $hiddenValue . "</strong><br>";
 
form_calc.php (added)
+++ form_calc.php
@@ -0,0 +1,31 @@
+<!doctype html>
+<html lang="ko">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+    <style>
+        #page {margin: 0 auto; background-color: antiquewhite; width: 500px; text-align: center;}
+        #num1, #num2 {width: 30px;}
+        .calc {width: 100px; height: 50px;}
+    </style>
+</head>
+<body>
+    <div id="page">
+        <h2>Calculator</h2>
+        <form action="form_calc_receive.php" method="post">
+            <input type="text" name="num1" id="num1">
+            <select name="op" id="op">
+                <option value="+">+</option>
+                <option value="-">-</option>
+                <option value="*">X</option>
+                <option value="/">%</option>
+            </select>
+            <input type="text" name="num2" id="num2"><br><br>
+            <button class="calc" type="submit">Calc</button>
+        </form>
+    </div>
+</body>
+</html>(No newline at end of file)
 
form_calc_receive.php (added)
+++ form_calc_receive.php
@@ -0,0 +1,39 @@
+<!doctype html>
+<html lang="ko">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+    <style>
+        #page {margin: 0 auto; background-color: antiquewhite; width: 500px; text-align: center;}
+        .back {width: 100px; height: 50px;}
+     </style>
+</head>
+<body>
+    <div id="page">
+        <h2>Calculating Result</h2><hr>
+        <?php
+            $num1 = $_POST["num1"];
+            $op = $_POST["op"];
+            $num2 = $_POST["num2"];
+
+            if ($num1 != null && $num2 != null){
+                if($op == "+"){
+                    echo $num1 . "+" . $num2 . "=" . ($num1 + $num2);
+                }else if($op == "-"){
+                    echo $num1 . "-" . $num2 . "=" . ($num1 - $num2);
+                }else if($op == "*"){
+                    echo $num1 . "X" . $num2 . "=" . ($num1 * $num2);
+                }else{
+                    echo $num1 . "%" . $num2 . "=" . ($num1 / $num2);
+                }
+            }else{
+                echo "Error!!!";
+            }
+        ?>
+        <br><br><button class="back" onclick="history.back()">뒤로가기</button>
+    </div>
+</body>
+</html>(No newline at end of file)
Add a comment
List