📖
html 폼 메일 보내기

페이지 정보

본문

html 과 php[code]<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = $_POST["name"];
    $email = $_POST["email"];
    $message = $_POST["message"];
    $to = "your @ email.com"; // 받는 이메일 주소를 여기에 입력하세요.
    $subject = "문의하기 폼: $name";
    $headers = "From: $email";
    mail($to, $subject, $message, $headers);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>문의하기 폼</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        form {
            max-width: 600px;
            margin: 20px auto;
        }
        label {
            display: block;
            margin-bottom: 8px;
        }
        input, textarea {
            width: 100%;
            padding: 8px;
            margin-bottom: 16px;
            box-sizing: border-box;
        }
        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            cursor: pointer;
        }
    </style>
</head>
<body>
<form action="#" method="post">
    <label for="name">이름:</label>
    <input type="text" id="name" name="name" required>
    <label for="email">이메일:</label>
    <input type="email" id="email" name="email" required>
    <label for="message">내용:</label>
    <textarea id="message" name="message" rows="4" required></textarea>
    <input type="submit" value="보내기">
</form>
</body>
</html>[/code]
html 과 javaScript[code]<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>문의하기 폼</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        form {
            max-width: 600px;
            margin: 20px auto;
        }
        label {
            display: block;
            margin-bottom: 8px;
        }
        input, textarea {
            width: 100%;
            padding: 8px;
            margin-bottom: 16px;
            box-sizing: border-box;
        }
        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            cursor: pointer;
        }
    </style>
</head>
<body>
<form onsubmit="sendEmail(event)">
    <label for="name">이름:</label>
    <input type="text" id="name" name="name" required>
    <label for="email">이메일:</label>
    <input type="email" id="email" name="email" required>
    <label for="message">내용:</label>
    <textarea id="message" name="message" rows="4" required></textarea>
    <input type="submit" value="보내기">
</form>
<script>
    function sendEmail(event) {
        event.preventDefault();
        var name = document.getElementById('name').value;
        var email = document.getElementById('email').value;
        var message = document.getElementById('message').value;
        var subject = "문의하기 폼: " + name;
        var body = "이름: " + name + "\n이메일: " + email + "\n내용: " + message;
        var mailtoLink = "mailto:your @ email.com?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body);
        window.location.href = mailtoLink;
    }
</script>
</body>
</html>[/code]

댓글목록

등록된 댓글이 없습니다.


자료 목록
번호 제목 날짜
173
🫧
04-17
172
🫧
04-17
171
🫧
04-16
170
🫧
04-15
169
🫧
04-15
📖
🫧
04-13
167
🫧
04-13
166
🫧
04-13
165
🫧
04-13
164
🫧
04-13
163
🫧
04-10
162
🫧
04-10
161
🫧
04-09
160
🫧
04-09
159
🫧
04-08

🔍 검색

회사소개 개인정보처리방침 서비스이용약관
Copyright © rainbowgarden.shop All rights reserved.