PHP

PHP : OOP(class) 폼으로 전송받기

제주도 조랑말 2023. 4. 11. 16:33
728x90

login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>회원가입</title>
</head>
<body>
        <form action="pp.php" method="POST">
            <input type="text" name="id" id="id" placeholder="ID">
            <input type="password" name="pwd" id="pwd" placeholder="PWD">
            <input type="submit" value="log">

        </form>

</body>
</html>

 

pp.php

 

<?php
    header('Content-Type: text/html; charset=UTF-8');
    class User{
        public $id, $pwd;

        function save_user(){
            echo '저장';
        }
    }

    $row = new User;
    $row-> id =$_POST['id'];
    $row-> pwd = $_POST['pwd'];
    $row->save_user();
    var_dump($row);





?>

활용해서 db 연동해보기

728x90

'PHP' 카테고리의 다른 글

PHP : $_SESSION, session 종료  (0) 2023.04.20
PHP : isset() 과 empty() 차이  (0) 2023.04.11
PHP : Header location을 이용한 페이지 이동  (0) 2023.04.11
PHP : 글 깨짐 방지  (0) 2023.04.10
PHP : MYSQL 객체지향  (0) 2023.04.10