WEB2 - PHP

PHP에서 FORM과 POST

수업소개

서버로 데이터를 전송할 때 사용하는 HTML의 기능인 form을 살펴봅니다. 또, URL을 통하지 않고 은밀하게 데이터를 전송하는 방법인 POST 방식도 알아보겠습니다. 

 

 

form.html

<!doctype html>
<html>
  <body>
    <form action="form.php" method="post">
      <p><input type="text" name="title" placeholder="Title"></p>
      <p><textarea name="description"></textarea></p>
      <p><input type="submit"></p>
    </form>
  </body>
</html>

form.php

<?php
file_put_contents('data/'.$_POST['title'], $_POST['description']);
?>

 

댓글

댓글 본문
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기