Son Yazılar:
Yükleniyor...

HTML 5 Php İletişim Formu Yapımı

HTML 5 Php İletişim Formu Yapımı çalışıyor.


HTML 5 Php İletişim Formu Yapımı çalışıyor.


Mail.php  Dosyamızı hazırlıyoruz  hostunumaza atıyoruz.

kırmızı  yazılı olan  yere kendimail  adresinizi  yazıyorsunuz .

kendınıze mail  atıp  deneyin  spam  düşebilir  bakın.

Sorusu  olan varsa yazsın

<?php
    
    // Only process POST reqeusts.
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        
        // Get the form fields and remove whitespace.
        $name = strip_tags(trim($_POST["name"]));
        $subject = strip_tags(trim($_POST["subject"]));
        $number = strip_tags(trim($_POST["number"]));
        $name = str_replace(array("\r","\n"),array(" "," "),$name);
        $email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
        $message = trim($_POST["message"]);

        // Check that data was sent to the mailer.
        if ( empty($name) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
            // Set a 400 (bad request) response code and exit.
            http_response_code(400);
            echo "Hata! Mesaj Gönderilmedi.";
            exit;
        }

        ////////////////////////////////////////////
        ////////////////////////////////////////////
        
        // Set the recipient email address.
        
        // FIXME: Update this to your desired email address.
        $recipient = "mail adresiniz@gmail.com";

        ////////////////////////////////////////////
        ////////////////////////////////////////////
        
        
        // Set the email subject.
        $subject = "New Message from $name";

        // Build the email content.
        $email_content = "Name: $name\n";
        $email_content .= "Email: $email\n\n";
        $email_content .= "Subject: $subject\n\n";
        $email_content .= "Number: $number\n\n";
        $email_content .= "Message:\n$message\n";

        // Build the email headers.
        $email_headers = "From: $name <$email>";

        // Send the email.
        if (mail($recipient, $subject, $email_content, $email_headers)) {
            // Set a 200 (okay) response code.
            http_response_code(200);
            echo "Teşekkürler mesajınız  iletilmiştir.";
        } else {
            // Set a 500 (internal server error) response code.
            http_response_code(500);
            echo "Hata! Bir şeyler yanlış gitti. Lütfen tekrar deneyin.";
        }

    } else {
        // Not a POST request, set a 403 (forbidden) response code.
        http_response_code(403);
        echo "Hata! Bir şeyler yanlış gitti.";
    }
?>


sonra css kodlarınızı temanızın css bölümüne ekleyin css kodları


/* Contact Area CSS */

.fplus-contact-area {
    position: relative;
    z-index: 1;
    min-height: 237.5px;
}

.contact_from {
    background-color: #fff;
    padding: 80px;
    box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 99;
    top: 0;
}



.contact_input_area .form-group .form-control {
    padding: 10px 0;
    line-height: 1;
    border: none;
    border-bottom: 1px solid #959595;
    border-radius: 0;
    font-size: 12px;
    color: #959595;
    font-weight: 300;
}

.contact_input_area .form-group textarea.form-control {
    height: 100px;
}

.contact_input_area .form-group .form-control:active,
.contact_input_area .form-group .form-control:focus {
    box-shadow: none;
    border-bottom: 1px solid #000000;
    color: #000000;
}

.contact_input_area button {
    width: 200px;
    height: 50px;
    background-color: #000000;
    color: #fff;
    font-size: 12px !important;
    text-transform: uppercase;
    line-height: 50px;
    padding: 0 !important;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 0 !important;
    margin-top: 50px;
}


sonra html kodları işlem bukadar


   <!-- ****** Contact Area Start ****** -->
    <section class="fplus-contact-area bg-gray" id="contact">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="section-heading text-center">
                        
                        <div class="section-heading-line"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="fplus-contact-area">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-md-10">
                        <div class="contact_from wow fadeInDown" data-wow-delay="1.5s">
                            <form action="mail.php" method="post" id="main_contact_form">
                                <!-- Message Input Area Start -->
                                <div class="contact_input_area">
                                    <div id="success_fail_info"></div>
                                    <div class="row">
                                        <!-- Single Input Area Start -->
                                        <div class="col-12 col-md-6">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="name" id="name" placeholder="Ad Soyad" required>
                                            </div>
                                        </div>
                                        <!-- Single Input Area Start -->
                                        <div class="col-12 col-md-6">
                                            <div class="form-group">
                                                <input type="email" class="form-control" name="email" id="email" placeholder="Email" required>
                                            </div>
                                        </div>
                                        
                                        <!-- Single Input Area Start -->
                                        <div class="col-12 col-md-6">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="number" id="number" placeholder="Telefon" required>
                                            </div>
                                        </div>
                                        <!-- Single Input Area Start -->
                                        <div class="col-12">
                                            <div class="form-group">
                                                <textarea name="message" class="form-control" id="message" cols="30" rows="10" placeholder="Mesaj" required></textarea>
                                            </div>
                                        </div>
                                        <!-- Single Input Area Start -->
                                        <div class="col-12 text-center">
                                            <button type="submit" class="btn">Mesaj Yolla</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
     
    </section>
    <!-- ****** Contact Area End ****** -->


Demosu ama mail.php yok siz kendiniz hosta atarsınız. https://codepen.io/bloggeriz/full/povdrKX

3 Yorumlar

Yorum Gönder

Daha yeni Daha eski