{"id":343,"date":"2024-04-07T02:25:30","date_gmt":"2024-04-07T02:25:30","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=343"},"modified":"2025-01-30T03:33:05","modified_gmt":"2025-01-30T03:33:05","slug":"form1-php-post-method-data-form-transmission","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2024\/04\/07\/form1-php-post-method-data-form-transmission\/","title":{"rendered":"form1.php POST\ubc29\uc2dd \ud3fc \ub370\uc774\ud130\uc804\uc1a1POST method data form transmission"},"content":{"rendered":"\n<iframe loading=\"lazy\" src=\"https:\/\/www.facebook.com\/plugins\/video.php?height=314&#038;href=https%3A%2F%2Fwww.facebook.com%2Fgideonslife01%2Fvideos%2F1206333330347061%2F&#038;show_text=false&#038;width=560&#038;t=0\" width=\"560\" height=\"314\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowfullscreen=\"true\" allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\" allowFullScreen=\"true\"><\/iframe>\n\n\n\n<p><br><br>php\uc5d0\uc11c \ud3fc\ub370\uc774\ud130\ub97c \uc804\uc1a1\ud558\ub294 \ubc29\uc2dd\uc740 POST\ubc29\uc2dd\uacfc GET\ubc29\uc2dd\uc774 \uc788\uc2b5\ub2c8\ub2e4. <br>\uc77c\ubc18\uc801\uc73c\ub85c \ud3fc\uc744 \ud1b5\ud55c \ub370\uc774\ud130\uc804\uc1a1\uc740 POST\ubc29\uc2dd\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>form1.php\ud30c\uc77c\uc740 \ud3fc\uc5d0 \ub0b4\uc6a9\uc744 \uc791\uc131\ud558\uace0 \ub370\uc774\ud130 \uc804\uc1a1\ud558\ub294 \ud30c\uc77c\uc774\uace0 <br>form_action1.php\ud30c\uc77c\uc740 \uc804\uc1a1 \ubc1b\uc740 \ub370\uc774\ud130\ub97c \ucc98\ub9ac\ud558\ub294 \ud30c\uc77c\uc785\ub2c8\ub2e4.<br>\uc544\ub798\ub294 form1.php\ud30c\uc77c\uc758 \ucf54\ub4dc \uc124\uba85\uc785\ub2c8\ub2e4.<br><br>There are two ways to transmit form data in PHP: POST method and GET method.<br>Generally, data transmission through forms uses the POST method.<br>The form1.php file is a file that writes content in the form and transmits data.<br>The form_action1.php file is a file that processes transmitted data.<br>Below is the code explanation of the form1.php file.<\/p>\n\n\n\n<p><strong>1.\ud30c\uc77c\uc874\uc7ac \uc5ec\ubd80 \uccb4\ud06c(Check whether file exists)<\/strong><br>&#8211; <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-orange-color\">is_file(&#8220;FILE NAME&#8221;)<\/mark> : \ud30c\uc77c\uc774 \uc874\uc7ac\ud558\uba74 true,\uc874\uc7ac\ud558\uc9c0 \uc54a\uc73c\uba74 false\ubc18\ud658<br>                                 Returns true if the file exists, false if it does not exist.<br><br>&#8211; <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-green-color\">$form_action_name<\/mark> : \uc774 \ubcc0\uc218\uc5d0 \ub370\uc774\ud130 \uc804\uc1a1\ud558\uae30 \uc704\ud55c \uc704\uce58 \ud30c\uc77c \uc774\ub984\uc744 \uc800\uc7a5\ud55c\ub2e4.<br>                                 form_action1.php\ud30c\uc77c\uc774 \uc874\uc7ac\ud558\uc9c0 \uc54a\uc73c\uba74 form1.php\ud30c\uc77c\uc774\ub984\uc744 \uc800\uc7a5\ud55c\ub2e4.<br>                                 Store the location file name for data transfer in this variable.<br>                                 If the form_action1.php file does not exist, save the form1.php file name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$fileName = \".\/form_action1.php\";\nif(!<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-orange-color\">is_file($fileName)<\/mark>){\n    <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-green-color\">$form_action_name<\/mark> = \".\/form1.php\";\n}else{\n    <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-green-color\">$form_action_name<\/mark> = \".\/form_action1.php\";\n}\n?&gt;<\/code><\/pre>\n\n\n\n<p><br><strong>2.\ubd80\ud2b8\uc2a4\ud2b8\ub7a9 CDN\ubc29\uc2dd \ub9c1\ud06c(Bootstrap CDN link)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>      &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n      &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/js\/bootstrap.bundle.min.js\"&gt;&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p><strong>3.\ubdf0\ud3ec\ud2b8(View Port)<\/strong><br>&#8211; \ud734\ub300\ud3f0\uc73c\ub85c \ubcfc \ub54c \ud654\uba74 \ud574\uc0c1\ub3c4\ub97c \ucd5c\uc801\ud654 \ud569\ub2c8\ub2e4.<br>&#8211; Optimizing screen resolution when viewing on a phone.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;<\/code><\/pre>\n\n\n\n<p><strong>4.\ub370\uc774\ud130 \uc804\uc1a1\ub420 \ud30c\uc77c \uc774\ub984 \ucd9c\ub825(Output file name to which data will be transferred)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form action=\"&lt;?php echo $form_action_name; ?&gt;\" method=\"post\"&gt;<\/code><\/pre>\n\n\n\n<p><strong>5.\ub370\uc774\ud130 \uc785\ub825(Data input)<\/strong><br>&#8211; \uc544\ub798\uc5d0\uc11c name =&#8221;\ud14d\uc2a4\ud2b8 \ud544\ub4dc \uc774\ub984&#8221; \uc774 \ubd80\ubd84\uc758 &#8220;\ud14d\uc2a4\ud2b8 \ud544\ub4dc \uc774\ub984&#8221; \uc774 \ubd80\ubd84\uc774 \ubcc0\uc218\uba85\uc774 \ub41c\ub2e4. <br>&#8211; \uc774 \ubcc0\uc218\uba85\uc73c\ub85c form_action1.php\ud30c\uc77c\uc5d0\uc11c \ub370\uc774\ud130\ub97c \ucc98\ub9ac\ud558\uac8c \ub41c\ub2e4.<br><br>&#8211; Below, the &#8220;text field name&#8221; part of &#8216; name = &#8220;text field name&#8221; &#8216; becomes the variable name.<br>&#8211; Data is processed in the form_action1.php file with this variable name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    &lt;input type=\"text\" class=\"form-control\" id=\"name\" placeholder=\"\ub2f9\uc2e0\uc758 \uc774\ub984\uc744 \uc785\ub825\ud558\uc138\uc694(Enter Your Name)\"<strong> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-orange-color\">name=\"name\"<\/mark><\/strong>&gt;\n    &lt;input type=\"password\" class=\"form-control\" id=\"pwd\" placeholder=\"Enter password\" <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-orange-color\">name=\"pswd\"<\/mark>&gt;\n       \n<\/code><\/pre>\n\n\n\n<p><strong>6.\uc804\uccb4\ucf54\ub4dc(full code<\/strong>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$fileName = \".\/form_action1.php\";\nif(!is_file($fileName)){\n    $form_action_name = \".\/form1.php\";\n}else{\n    $form_action_name = \".\/form_action1.php\";\n}\n?&gt;\n\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n    &lt;head&gt;\n      &lt;title&gt;Bootstrap 5 Example&lt;\/title&gt;\n      &lt;meta charset=\"utf-8\"&gt;\n      &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\n      &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n      &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/js\/bootstrap.bundle.min.js\"&gt;&lt;\/script&gt;\n    &lt;\/head&gt;\n    &lt;body&gt;\n        &lt;form action=\"&lt;?php echo $form_action_name; ?&gt;\" method=\"post\"&gt;\n        &lt;div class=\"mb-3 mt-3\"&gt;\n            &lt;label for=\"name\" class=\"form-label\"&gt;\uc774\ub984(Name):&lt;\/label&gt;\n            &lt;input type=\"name\" class=\"form-control\" id=\"name\" placeholder=\"\ub2f9\uc2e0\uc758 \uc774\ub984\uc744 \uc785\ub825\ud558\uc138\uc694(Enter Your Name)\" name=\"name\"&gt;\n        &lt;\/div&gt;\n        &lt;div class=\"mb-3\"&gt;\n            &lt;label for=\"pwd\" class=\"form-label\"&gt;Password:&lt;\/label&gt;\n            &lt;input type=\"password\" class=\"form-control\" id=\"pwd\" placeholder=\"Enter password\" name=\"pswd\"&gt;\n        &lt;\/div&gt;\n            &lt;div class=\"form-check mb-3\"&gt;\n            &lt;label class=\"form-check-label\"&gt;\n            &lt;input class=\"form-check-input\" type=\"checkbox\" name=\"remember\"&gt; Remember me\n            &lt;\/label&gt;\n        &lt;\/div&gt;\n            &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;Submit&lt;\/button&gt;\n        &lt;\/form&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;    \n<\/code><\/pre>\n\n\n\n<p><strong>7.\uc2e4\ud589\ud655\uc778(Check execution)<\/strong><br><a rel=\"noreferrer noopener\" href=\"https:\/\/freelifemakers.org\/lec\/form1.php\" target=\"_blank\">https:\/\/freelifemakers.org\/lec\/form1.php<\/a><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>php\uc5d0\uc11c \ud3fc\ub370\uc774\ud130\ub97c \uc804\uc1a1\ud558\ub294 \ubc29\uc2dd\uc740 POST\ubc29\uc2dd\uacfc GET\ubc29\uc2dd\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c \ud3fc\uc744 \ud1b5\ud55c \ub370\uc774\ud130\uc804\uc1a1\uc740 POST\ubc29\uc2dd\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.form1.php\ud30c\uc77c\uc740 \ud3fc\uc5d0 \ub0b4\uc6a9\uc744 \uc791\uc131\ud558\uace0 \ub370\uc774\ud130 \uc804\uc1a1\ud558\ub294 \ud30c\uc77c\uc774\uace0 form_action1.php\ud30c\uc77c\uc740 \uc804\uc1a1 \ubc1b\uc740 \ub370\uc774\ud130\ub97c \ucc98\ub9ac\ud558\ub294 \ud30c\uc77c\uc785\ub2c8\ub2e4.\uc544\ub798\ub294 form1.php\ud30c\uc77c\uc758 \ucf54\ub4dc \uc124\uba85\uc785\ub2c8\ub2e4. There are two ways to transmit form data in PHP: POST method and GET method.Generally, data transmission through forms uses the POST method.The form1.php file is a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-php","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":9,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":1114,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions\/1114"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}