• 02-08-2024, 13:29:40
    #1
    Merhabalar,

    aşağıda vereceğim kodda bir iletişim formu mevcut ancak mesajı gönder butonuna tıklayınca sadece lütfen bekleyin... yazıyor ve mesajı gönderiyor ancak mesajın gönderildiğine dair bir şey ekleyemedim bir türlü ve mesajı gönderdikten sonra da formu boşaltması gerekiyor ama olmuyor nedense...
    Bu konuda yardımcı olabilecek var ise sevinirim, teşekkürler.

    <?php
    require_once 'assets/inc/config.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
    
    require 'PHPMailer/src/Exception.php'; //Exception.php dosya yolu
    require 'PHPMailer/src/PHPMailer.php'; //PHPMailer.php dosya yolu
    require 'PHPMailer/src/SMTP.php'; //SMTP.php dosya yolu
    
    $mail = new PHPMailer(true);
    if ($_POST){
    try {
        //Server settings
        $mail->CharSet = 'UTF-8';
        $mail->SMTPDebug = 0; // 0: debug kapalı, 1: debug açık
        $mail->isSMTP();
        $mail->Host = SUNUCU; // SMTP sunucu adı
        $mail->SMTPAuth = true; // SMTP Doğrulama
        $mail->Username = EPOSTA; // SMTP kullanıcı adı
        $mail->Password = PASSWORD; // SMTP kullanıcısının şifresi
        $mail->SMTPSecure = 'tls'; // Şifreleme
        $mail->Port = PORT; // SMTP Port
    
        // Gönderen bilgilerini ayarla
        $mail->setFrom(EPOSTA, 'Geridönüşüm');
        $mail->addAddress(EPOSTA, 'Info');
        
        // Yanıt adresini formdan al
        if(isset($_POST['form_email']) && isset($_POST['form_name'])) {
            $mail->addReplyTo($_POST['form_email'], $_POST['form_name']);
        } else {
            throw new Exception('Form verileri eksik!');
        }
    
        $mail->isHTML(true);
        $mail->Subject = 'Yeni İletişim Mesajı';
        $mail->Body    = '<p>Gönderen: ' . htmlspecialchars($_POST['form_name']) . '</p>' .
                          '<p>Email: ' . htmlspecialchars($_POST['form_email']) . '</p>' .
                          '<p>Telefon: ' . htmlspecialchars($_POST['form_phone']) . '</p>' .
                          '<p>Konu: ' . htmlspecialchars($_POST['form_subject']) . '</p>' .
                          '<p>Mesaj: ' . nl2br(htmlspecialchars($_POST['form_message'])) . '</p>';
    
        //Üçüncü taraf SMTP sunucusu ile barındırma sunucusu entegrasyonu için gerekebilir
        $mail->SMTPOptions = array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            )
        );
    
        $mail->send();
        echo "Mesajınız başarıyla gönderildi. Teşekkür ederiz!";
    } catch (Exception $e) {
        echo 'Mesajınız iletilemedi. Hata: ', htmlspecialchars($e->getMessage());
    }
    
    }
    include "header.php"; ?>
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>İletişim</title>
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
        <style>
            #map { height: 400px; width: 100%; }
        </style>
    </head>
    
    <body>
        <!--Start breadcrumb area paroller-->
        <section class="breadcrumb-area">
            <div class="breadcrumb-area-bg" style="background-image: url(assets/images/breadcrumb/breadcrumb-1.jpg);"></div>
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="inner-content">
                            <div class="breadcrumb-menu" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="1500">
                                <ul>
                                    <li><a href="index.php">Ana Sayfa</a></li>
                                    <li class="active">İletişim</li>
                                </ul>
                            </div>
                            <div class="title" data-aos="fade-up" data-aos-easing="linear" data-aos-duration="1500">
                                <h2>İletişim</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End breadcrumb area-->
    
        <!--Start Google Map Style2 Area-->
    <section class="google-map-area">
        <div class="auto-container">
            <div class="contact-page-map-outer">
                <!-- Google Maps iframe -->
                <iframe
                    src="link"
                    width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
                        
                        </div>
                </iframe>
                <!-- Contact Information Box -->
            </div>
        </div>
    </section>
    <!--End Google Map Style2 Area-->
    
        <!--End Google Map Style2 Area-->
    
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row">
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-info-box">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Dokun ve bizimle iletişime geç!</h3>
                                </div>
                                <h2>İletişim Seçeneklerimiz</h2>
                            </div>
                            <div class="contact-info-list">
                                <ul>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-telephone"></span>
                                        </div>
                                        <div class="text">
                                            <p>Telefon ile iletişime geç.</p>
                                            <h4><a href="tel:+905380320786">+(90) 538 032 07 86</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-email-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>E-posta Gönder</p>
                                            <h4><a href="mailto:info@geridonusum.com">info@geridonusum.com</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-pin-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>Konumumuzu ziyaret edin</p>
                                            <h4>Adres</h4>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
    
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-form contact-form--style2">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Mesaj Gönder</h3>
                                </div>
                                <h2>Bize Bir Mesaj Gönder</h2>
                            </div>
    
                            <form id="contact-form" name="contact_form" class="default-form2" method="post">
        <div class="row">
            <div class="col-xl-12">
                <div class="form-group">
                    <div class="input-box">
                        <input type="text" name="form_name" id="formName" placeholder="İsim Soyisim" required="">
                    </div>
                </div>
            </div>
            <div class="col-xl-12">
                <div class="form-group">
                    <div class="input-box">
                        <input type="email" name="form_email" id="formEmail" placeholder="Eposta Adresi" required="">
                    </div>
                </div>
            </div>
            <div class="col-xl-12">
                <div class="form-group">
                    <div class="input-box">
                        <input type="text" name="form_phone" id="formPhone" placeholder="Telefon Numarası">
                    </div>
                </div>
            </div>
            <div class="col-xl-12">
                <div class="form-group">
                    <div class="input-box">
                        <input type="text" name="form_subject" id="formSubject" placeholder="Konu">
                    </div>
                </div>
            </div>
            <div class="col-xl-12">
                <div class="form-group">
                    <div class="input-box">
                        <textarea name="form_message" id="formMessage" placeholder="Mesajınız" required=""></textarea>
                    </div>
                </div>
            </div>
            <div class="col-xl-12">
                <div class="button-box">
                    <input id="form_botcheck" name="form_botcheck" class="form-control" type="hidden" value="">
                    <button class="btn-one" type="submit" data-loading-text="Lütfen Bekleyin...">
                        <span class="txt">Mesajı Gönder<i class="icon-refresh arrow"></i></span>
                    </button>
                </div>
            </div>
        </div>
    </form>
    
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
    
        <button class="scroll-top scroll-to-target" data-target="html">
            <span class="flaticon-up-arrow"></span>
        </button>
    
        <!-- search-popup -->
        <div id="search-popup" class="search-popup">
            <div class="close-search"><i class="icon-close"></i></div>
            <div class="popup-inner">
                <div class="overlay-layer"></div>
                <div class="search-form">
                    <form method="post" action="index.php">
                        <div class="form-group">
                            <fieldset>
                                <input type="search" class="form-control" name="search-input" placeholder="Sitede Ara" required>
                                <input type="submit" value="Ara & Bul!" class="theme-btn style-four">
                            </fieldset>
                        </div>
                    </form>
                    <h3>Geçmişte Arananlar</h3>
                    <ul class="recent-searches">
                        <li><a href="index.php">atık</a></li>
                        <li><a href="index.php">konteynır</a></li>
                        <li><a href="index.php">geri dönüşüm</a></li>
                        <li><a href="index.php">büyük çöp</a></li>
                        <li><a href="index.php">çöp</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- search-popup end -->
    
        <script src="assets/js/jquery.js"></script>
        <script src="assets/js/aos.js"></script>
        <script src="assets/js/appear.js"></script>
        <script src="assets/js/bootstrap.bundle.min.js"></script>
        <script src="assets/js/isotope.js"></script>
        <script src="assets/js/jquery.bootstrap-touchspin.js"></script>
        <script src="assets/js/jquery.countTo.js"></script>
        <script src="assets/js/jquery.easing.min.js"></script>
        <script src="assets/js/jquery.event.move.js"></script>
        <script src="assets/js/jquery.fancybox.js"></script>
        <script src="assets/js/jquery.magnific-popup.min.js"></script>
        <script src="assets/js/jquery.nice-select.min.js"></script>
        <script src="assets/js/jquery.paroller.min.js"></script>
        <script src="assets/js/jquery-sidebar-content.js"></script>
        <script src="assets/js/knob.js"></script>
        <script src="assets/js/map-script.js"></script>
        <script src="assets/js/owl.js"></script>
        <script src="assets/js/pagenav.js"></script>
        <script src="assets/js/scrollbar.js"></script>
        <script src="assets/js/swiper.min.js"></script>
        <script src="assets/js/tilt.jquery.js"></script>
        <script src="assets/js/TweenMax.min.js"></script>
        <script src="assets/js/validation.js"></script>
        <script src="assets/js/wow.js"></script>
        <script src="assets/js/jquery-1color-switcher.min.js"></script>
        <!-- thm custom script -->
        <script src="assets/js/custom.js"></script>
    </body>
    </html>
    <?php include "footer.php"; ?>
  • 02-08-2024, 13:48:47
    #2
    <?php
    require_once 'assets/inc/config.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
     
    require 'PHPMailer/src/Exception.php'; //Exception.php dosya yolu
    require 'PHPMailer/src/PHPMailer.php'; //PHPMailer.php dosya yolu
    require 'PHPMailer/src/SMTP.php'; //SMTP.php dosya yolu
     
    $mail = new PHPMailer(true);
    $responseMessage = '';
    if ($_POST){
        try {
            //Server settings
            $mail->CharSet = 'UTF-8';
            $mail->SMTPDebug = 0; // 0: debug kapalı, 1: debug açık
            $mail->isSMTP();
            $mail->Host = SUNUCU; // SMTP sunucu adı
            $mail->SMTPAuth = true; // SMTP Doğrulama
            $mail->Username = EPOSTA; // SMTP kullanıcı adı
            $mail->Password = PASSWORD; // SMTP kullanıcısının şifresi
            $mail->SMTPSecure = 'tls'; // Şifreleme
            $mail->Port = PORT; // SMTP Port
     
            // Gönderen bilgilerini ayarla
            $mail->setFrom(EPOSTA, 'Geridönüşüm');
            $mail->addAddress(EPOSTA, 'Info');
             
            // Yanıt adresini formdan al
            if(isset($_POST['form_email']) && isset($_POST['form_name'])) {
                $mail->addReplyTo($_POST['form_email'], $_POST['form_name']);
            } else {
                throw new Exception('Form verileri eksik!');
            }
     
            $mail->isHTML(true);
            $mail->Subject = 'Yeni İletişim Mesajı';
            $mail->Body    = '<p>Gönderen: ' . htmlspecialchars($_POST['form_name']) . '</p>' .
                              '<p>Email: ' . htmlspecialchars($_POST['form_email']) . '</p>' .
                              '<p>Telefon: ' . htmlspecialchars($_POST['form_phone']) . '</p>' .
                              '<p>Konu: ' . htmlspecialchars($_POST['form_subject']) . '</p>' .
                              '<p>Mesaj: ' . nl2br(htmlspecialchars($_POST['form_message'])) . '</p>';
     
            //Üçüncü taraf SMTP sunucusu ile barındırma sunucusu entegrasyonu için gerekebilir
            $mail->SMTPOptions = array(
                'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );
     
            $mail->send();
            $responseMessage = "Mesajınız başarıyla gönderildi. Teşekkür ederiz!";
        } catch (Exception $e) {
            $responseMessage = 'Mesajınız iletilemedi. Hata: ' . htmlspecialchars($e->getMessage());
        }
    }
    include "header.php"; 
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>İletişim</title>
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
        <style>
            #map { height: 400px; width: 100%; }
    
            /* Popup Message Styles */
            #popup-message {
                position: fixed;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background-color: #fff;
                padding: 20px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                z-index: 1000;
                display: none;
            }
    
            .popup-content {
                text-align: center;
            }
    
            .popup-content p {
                margin-bottom: 20px;
            }
    
            .popup-content button {
                padding: 10px 20px;
                background-color: #007bff;
                color: #fff;
                border: none;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <!--Start breadcrumb area paroller-->
        <section class="breadcrumb-area">
            <div class="breadcrumb-area-bg" style="background-image: url(assets/images/breadcrumb/breadcrumb-1.jpg);"></div>
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="inner-content">
                            <div class="breadcrumb-menu" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="1500">
                                <ul>
                                    <li><a href="index.php">Ana Sayfa</a></li>
                                    <li class="active">İletişim</li>
                                </ul>
                            </div>
                            <div class="title" data-aos="fade-up" data-aos-easing="linear" data-aos-duration="1500">
                                <h2>İletişim</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End breadcrumb area-->
     
        <!--Start Google Map Style2 Area-->
        <section class="google-map-area">
            <div class="auto-container">
                <div class="contact-page-map-outer">
                    <!-- Google Maps iframe -->
                    <iframe
                        src="link"
                        width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
                             
                            </div>
                    </iframe>
                    <!-- Contact Information Box -->
                </div>
            </div>
        </section>
        <!--End Google Map Style2 Area-->
     
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row">
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-info-box">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Dokun ve bizimle iletişime geç!</h3>
                                </div>
                                <h2>İletişim Seçeneklerimiz</h2>
                            </div>
                            <div class="contact-info-list">
                                <ul>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-telephone"></span>
                                        </div>
                                        <div class="text">
                                            <p>Telefon ile iletişime geç.</p>
                                            <h4><a href="tel:+905380320786">+(90) 538 032 07 86</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-email-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>E-posta Gönder</p>
                                            <h4><a href="mailto:info@geridonusum.com">info@geridonusum.com</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-pin-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>Konumumuzu ziyaret edin</p>
                                            <h4>Adres</h4>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
     
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-form contact-form--style2">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Mesaj Gönder</h3>
                                </div>
                                <h2>Bize Bir Mesaj Gönder</h2>
                            </div>
     
                            <form id="contact-form" name="contact_form" class="default-form2" method="post">
                                <div class="row">
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_name" id="formName" placeholder="İsim Soyisim" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="email" name="form_email" id="formEmail" placeholder="Eposta Adresi" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_phone" id="formPhone" placeholder="Telefon Numarası">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_subject" id="formSubject" placeholder="Konu">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <textarea name="form_message" id="formMessage" placeholder="Mesajınız..."></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <button class="btn-one" type="submit" data-loading-text="Please wait...">Mesaj Gönder</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <!-- Popup Message -->
                            <div id="popup-message" style="display: none;">
                                <div class="popup-content">
                                    <p>Mesajınız başarıyla gönderildi. Teşekkür ederiz!</p>
                                    <button onclick="closePopup()">Kapat</button>
                                </div>
                            </div>
                        </div>
                    </div>
     
                </div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
    
        <script>
            // Function to show the popup
            function showPopup() {
                document.getElementById('popup-message').style.display = 'block';
            }
    
            // Function to close the popup
            function closePopup() {
                document.getElementById('popup-message').style.display = 'none';
            }
    
            // Function to clear form inputs
            function clearForm() {
                document.getElementById('contact-form').reset();
            }
    
            // Event listener for form submission
            document.getElementById('contact-form').addEventListener('submit', function(event) {
                event.preventDefault(); // Prevent default form submission
    
                // Send the form data using AJAX
                var xhr = new XMLHttpRequest();
                xhr.open('POST', 'path/to/your/php/file.php', true); // Adjust the path as needed
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
                xhr.onreadystatechange = function() {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        if (xhr.responseText.includes('Mesajınız başarıyla gönderildi. Teşekkür ederiz!')) {
                            showPopup();
                            clearForm();
                        } else {
                            alert('Mesajınız iletilemedi. Hata: ' + xhr.responseText);
                        }
                    }
                };
    
                var formData = new FormData(document.getElementById('contact-form'));
                var encodedData = new URLSearchParams(formData).toString();
                xhr.send(encodedData);
            });
        </script>
    
    </body>
    </html>
  • 02-08-2024, 13:53:38
    #3
    shms adlı üyeden alıntı: mesajı görüntüle
    <?php
    require_once 'assets/inc/config.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
     
    require 'PHPMailer/src/Exception.php'; //Exception.php dosya yolu
    require 'PHPMailer/src/PHPMailer.php'; //PHPMailer.php dosya yolu
    require 'PHPMailer/src/SMTP.php'; //SMTP.php dosya yolu
     
    $mail = new PHPMailer(true);
    $responseMessage = '';
    if ($_POST){
        try {
            //Server settings
            $mail->CharSet = 'UTF-8';
            $mail->SMTPDebug = 0; // 0: debug kapalı, 1: debug açık
            $mail->isSMTP();
            $mail->Host = SUNUCU; // SMTP sunucu adı
            $mail->SMTPAuth = true; // SMTP Doğrulama
            $mail->Username = EPOSTA; // SMTP kullanıcı adı
            $mail->Password = PASSWORD; // SMTP kullanıcısının şifresi
            $mail->SMTPSecure = 'tls'; // Şifreleme
            $mail->Port = PORT; // SMTP Port
     
            // Gönderen bilgilerini ayarla
            $mail->setFrom(EPOSTA, 'Geridönüşüm');
            $mail->addAddress(EPOSTA, 'Info');
            
            // Yanıt adresini formdan al
            if(isset($_POST['form_email']) && isset($_POST['form_name'])) {
                $mail->addReplyTo($_POST['form_email'], $_POST['form_name']);
            } else {
                throw new Exception('Form verileri eksik!');
            }
     
            $mail->isHTML(true);
            $mail->Subject = 'Yeni İletişim Mesajı';
            $mail->Body    = '<p>Gönderen: ' . htmlspecialchars($_POST['form_name']) . '</p>' .
                              '<p>Email: ' . htmlspecialchars($_POST['form_email']) . '</p>' .
                              '<p>Telefon: ' . htmlspecialchars($_POST['form_phone']) . '</p>' .
                              '<p>Konu: ' . htmlspecialchars($_POST['form_subject']) . '</p>' .
                              '<p>Mesaj: ' . nl2br(htmlspecialchars($_POST['form_message'])) . '</p>';
     
            //Üçüncü taraf SMTP sunucusu ile barındırma sunucusu entegrasyonu için gerekebilir
            $mail->SMTPOptions = array(
                'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );
     
            $mail->send();
            $responseMessage = "Mesajınız başarıyla gönderildi. Teşekkür ederiz!";
        } catch (Exception $e) {
            $responseMessage = 'Mesajınız iletilemedi. Hata: ' . htmlspecialchars($e->getMessage());
        }
    }
    include "header.php";
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>İletişim</title>
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
        <style>
            #map { height: 400px; width: 100%; }
    
            /* Popup Message Styles */
            #popup-message {
                position: fixed;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background-color: #fff;
                padding: 20px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                z-index: 1000;
                display: none;
            }
    
            .popup-content {
                text-align: center;
            }
    
            .popup-content p {
                margin-bottom: 20px;
            }
    
            .popup-content button {
                padding: 10px 20px;
                background-color: #007bff;
                color: #fff;
                border: none;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <!--Start breadcrumb area paroller-->
        <section class="breadcrumb-area">
            <div class="breadcrumb-area-bg" style="background-image: url(assets/images/breadcrumb/breadcrumb-1.jpg);"></div>
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="inner-content">
                            <div class="breadcrumb-menu" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="1500">
                                <ul>
                                    <li><a href="index.php">Ana Sayfa</a></li>
                                    <li class="active">İletişim</li>
                                </ul>
                            </div>
                            <div class="title" data-aos="fade-up" data-aos-easing="linear" data-aos-duration="1500">
                                <h2>İletişim</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End breadcrumb area-->
     
        <!--Start Google Map Style2 Area-->
        <section class="google-map-area">
            <div class="auto-container">
                <div class="contact-page-map-outer">
                    <!-- Google Maps iframe -->
                    <iframe
                        src="link"
                        width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
                            
                            </div>
                    </iframe>
                    <!-- Contact Information Box -->
                </div>
            </div>
        </section>
        <!--End Google Map Style2 Area-->
     
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row">
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-info-box">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Dokun ve bizimle iletişime geç!</h3>
                                </div>
                                <h2>İletişim Seçeneklerimiz</h2>
                            </div>
                            <div class="contact-info-list">
                                <ul>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-telephone"></span>
                                        </div>
                                        <div class="text">
                                            <p>Telefon ile iletişime geç.</p>
                                            <h4><a href="tel:+905380320786">+(90) 538 032 07 86</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-email-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>E-posta Gönder</p>
                                            <h4><a href="mailto:info@geridonusum.com">info@geridonusum.com</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-pin-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>Konumumuzu ziyaret edin</p>
                                            <h4>Adres</h4>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
     
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-form contact-form--style2">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Mesaj Gönder</h3>
                                </div>
                                <h2>Bize Bir Mesaj Gönder</h2>
                            </div>
     
                            <form id="contact-form" name="contact_form" class="default-form2" method="post">
                                <div class="row">
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_name" id="formName" placeholder="İsim Soyisim" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="email" name="form_email" id="formEmail" placeholder="Eposta Adresi" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_phone" id="formPhone" placeholder="Telefon Numarası">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_subject" id="formSubject" placeholder="Konu">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <textarea name="form_message" id="formMessage" placeholder="Mesajınız..."></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <button class="btn-one" type="submit" data-loading-text="Please wait...">Mesaj Gönder</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <!-- Popup Message -->
                            <div id="popup-message" style="display: none;">
                                <div class="popup-content">
                                    <p>Mesajınız başarıyla gönderildi. Teşekkür ederiz!</p>
                                    <button onclick="closePopup()">Kapat</button>
                                </div>
                            </div>
                        </div>
                    </div>
     
                </div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
    
        <script>
            // Function to show the popup
            function showPopup() {
                document.getElementById('popup-message').style.display = 'block';
            }
    
            // Function to close the popup
            function closePopup() {
                document.getElementById('popup-message').style.display = 'none';
            }
    
            // Function to clear form inputs
            function clearForm() {
                document.getElementById('contact-form').reset();
            }
    
            // Event listener for form submission
            document.getElementById('contact-form').addEventListener('submit', function(event) {
                event.preventDefault(); // Prevent default form submission
    
                // Send the form data using AJAX
                var xhr = new XMLHttpRequest();
                xhr.open('POST', 'path/to/your/php/file.php', true); // Adjust the path as needed
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
                xhr.onreadystatechange = function() {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        if (xhr.responseText.includes('Mesajınız başarıyla gönderildi. Teşekkür ederiz!')) {
                            showPopup();
                            clearForm();
                        } else {
                            alert('Mesajınız iletilemedi. Hata: ' + xhr.responseText);
                        }
                    }
                };
    
                var formData = new FormData(document.getElementById('contact-form'));
                var encodedData = new URLSearchParams(formData).toString();
                xhr.send(encodedData);
            });
        </script>
    
    </body>
    </html>
    bu seferde mesajı gönder butonu tıklanmıyor hocam garip bir durum çözemedim...
  • 02-08-2024, 13:59:49
    #4
    <?php
    require_once 'assets/inc/config.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
    
    require 'PHPMailer/src/Exception.php'; // Exception.php dosya yolu
    require 'PHPMailer/src/PHPMailer.php'; // PHPMailer.php dosya yolu
    require 'PHPMailer/src/SMTP.php'; // SMTP.php dosya yolu
    
    $mail = new PHPMailer(true);
    $responseMessage = '';
    if ($_POST) {
        try {
            // Server settings
            $mail->CharSet = 'UTF-8';
            $mail->SMTPDebug = 0; // 0: debug kapalı, 1: debug açık
            $mail->isSMTP();
            $mail->Host = SUNUCU; // SMTP sunucu adı
            $mail->SMTPAuth = true; // SMTP Doğrulama
            $mail->Username = EPOSTA; // SMTP kullanıcı adı
            $mail->Password = PASSWORD; // SMTP kullanıcısının şifresi
            $mail->SMTPSecure = 'tls'; // Şifreleme
            $mail->Port = PORT; // SMTP Port
    
            // Gönderen bilgilerini ayarla
            $mail->setFrom(EPOSTA, 'Geridönüşüm');
            $mail->addAddress(EPOSTA, 'Info');
    
            // Yanıt adresini formdan al
            if (isset($_POST['form_email']) && isset($_POST['form_name'])) {
                $mail->addReplyTo($_POST['form_email'], $_POST['form_name']);
            } else {
                throw new Exception('Form verileri eksik!');
            }
    
            $mail->isHTML(true);
            $mail->Subject = 'Yeni İletişim Mesajı';
            $mail->Body    = '<p>Gönderen: ' . htmlspecialchars($_POST['form_name']) . '</p>' .
                              '<p>Email: ' . htmlspecialchars($_POST['form_email']) . '</p>' .
                              '<p>Telefon: ' . htmlspecialchars($_POST['form_phone']) . '</p>' .
                              '<p>Konu: ' . htmlspecialchars($_POST['form_subject']) . '</p>' .
                              '<p>Mesaj: ' . nl2br(htmlspecialchars($_POST['form_message'])) . '</p>';
    
            // Üçüncü taraf SMTP sunucusu ile barındırma sunucusu entegrasyonu için gerekebilir
            $mail->SMTPOptions = array(
                'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );
    
            $mail->send();
            $responseMessage = "Mesajınız başarıyla gönderildi. Teşekkür ederiz!";
        } catch (Exception $e) {
            $responseMessage = 'Mesajınız iletilemedi. Hata: ' . htmlspecialchars($e->getMessage());
        }
    }
    include "header.php";
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>İletişim</title>
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
        <style>
            #map { height: 400px; width: 100%; }
    
            /* Popup Message Styles */
            #popup-message {
                position: fixed;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background-color: #fff;
                padding: 20px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                z-index: 1000;
                display: <?php echo !empty($responseMessage) ? 'block' : 'none'; ?>;
            }
    
            .popup-content {
                text-align: center;
            }
    
            .popup-content p {
                margin-bottom: 20px;
            }
    
            .popup-content button {
                padding: 10px 20px;
                background-color: #007bff;
                color: #fff;
                border: none;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <!--Start breadcrumb area paroller-->
        <section class="breadcrumb-area">
            <div class="breadcrumb-area-bg" style="background-image: url(assets/images/breadcrumb/breadcrumb-1.jpg);"></div>
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="inner-content">
                            <div class="breadcrumb-menu" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="1500">
                                <ul>
                                    <li><a href="index.php">Ana Sayfa</a></li>
                                    <li class="active">İletişim</li>
                                </ul>
                            </div>
                            <div class="title" data-aos="fade-up" data-aos-easing="linear" data-aos-duration="1500">
                                <h2>İletişim</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End breadcrumb area-->
    
        <!--Start Google Map Style2 Area-->
        <section class="google-map-area">
            <div class="auto-container">
                <div class="contact-page-map-outer">
                    <!-- Google Maps iframe -->
                    <iframe
                        src="link"
                        width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
                             
                            </div>
                    </iframe>
                    <!-- Contact Information Box -->
                </div>
            </div>
        </section>
        <!--End Google Map Style2 Area-->
    
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row">
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-info-box">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Dokun ve bizimle iletişime geç!</h3>
                                </div>
                                <h2>İletişim Seçeneklerimiz</h2>
                            </div>
                            <div class="contact-info-list">
                                <ul>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-telephone"></span>
                                        </div>
                                        <div class="text">
                                            <p>Telefon ile iletişime geç.</p>
                                            <h4><a href="tel:+905380320786">+(90) 538 032 07 86</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-email-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>E-posta Gönder</p>
                                            <h4><a href="mailto:info@geridonusum.com">info@geridonusum.com</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-pin-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>Konumumuzu ziyaret edin</p>
                                            <h4>Adres</h4>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
    
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-form contact-form--style2">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Mesaj Gönder</h3>
                                </div>
                                <h2>Bize Bir Mesaj Gönder</h2>
                            </div>
    
                            <form id="contact-form" name="contact_form" class="default-form2" method="post" action="">
                                <div class="row">
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_name" id="formName" placeholder="İsim Soyisim" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="email" name="form_email" id="formEmail" placeholder="Eposta Adresi" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_phone" id="formPhone" placeholder="Telefon Numarası">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_subject" id="formSubject" placeholder="Konu">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <textarea name="form_message" id="formMessage" placeholder="Mesajınız..."></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <button class="btn-one" type="submit" data-loading-text="Please wait...">Mesaj Gönder</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <!-- Popup Message -->
                            <div id="popup-message">
                                <div class="popup-content">
                                    <p><?php echo htmlspecialchars($responseMessage); ?></p>
                                    <button onclick="closePopup()">Kapat</button>
                                </div>
                            </div>
                        </div>
                    </div>
     
                </div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
    
        <script>
            // Function to show the popup
            function showPopup() {
                document.getElementById('popup-message').style.display = 'block';
            }
    
            // Function to close the popup
            function closePopup() {
                document.getElementById('popup-message').style.display = 'none';
            }
    
            // Show popup if response message exists
            <?php if (!empty($responseMessage)) { ?>
                showPopup();
            <?php } ?>
        </script>
    
    </body>
    </html>

    şunu deneyin hocam son olarak
  • 02-08-2024, 14:02:00
    #5
    shms adlı üyeden alıntı: mesajı görüntüle
    <?php
    require_once 'assets/inc/config.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
    
    require 'PHPMailer/src/Exception.php'; // Exception.php dosya yolu
    require 'PHPMailer/src/PHPMailer.php'; // PHPMailer.php dosya yolu
    require 'PHPMailer/src/SMTP.php'; // SMTP.php dosya yolu
    
    $mail = new PHPMailer(true);
    $responseMessage = '';
    if ($_POST) {
        try {
            // Server settings
            $mail->CharSet = 'UTF-8';
            $mail->SMTPDebug = 0; // 0: debug kapalı, 1: debug açık
            $mail->isSMTP();
            $mail->Host = SUNUCU; // SMTP sunucu adı
            $mail->SMTPAuth = true; // SMTP Doğrulama
            $mail->Username = EPOSTA; // SMTP kullanıcı adı
            $mail->Password = PASSWORD; // SMTP kullanıcısının şifresi
            $mail->SMTPSecure = 'tls'; // Şifreleme
            $mail->Port = PORT; // SMTP Port
    
            // Gönderen bilgilerini ayarla
            $mail->setFrom(EPOSTA, 'Geridönüşüm');
            $mail->addAddress(EPOSTA, 'Info');
    
            // Yanıt adresini formdan al
            if (isset($_POST['form_email']) && isset($_POST['form_name'])) {
                $mail->addReplyTo($_POST['form_email'], $_POST['form_name']);
            } else {
                throw new Exception('Form verileri eksik!');
            }
    
            $mail->isHTML(true);
            $mail->Subject = 'Yeni İletişim Mesajı';
            $mail->Body    = '<p>Gönderen: ' . htmlspecialchars($_POST['form_name']) . '</p>' .
                              '<p>Email: ' . htmlspecialchars($_POST['form_email']) . '</p>' .
                              '<p>Telefon: ' . htmlspecialchars($_POST['form_phone']) . '</p>' .
                              '<p>Konu: ' . htmlspecialchars($_POST['form_subject']) . '</p>' .
                              '<p>Mesaj: ' . nl2br(htmlspecialchars($_POST['form_message'])) . '</p>';
    
            // Üçüncü taraf SMTP sunucusu ile barındırma sunucusu entegrasyonu için gerekebilir
            $mail->SMTPOptions = array(
                'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );
    
            $mail->send();
            $responseMessage = "Mesajınız başarıyla gönderildi. Teşekkür ederiz!";
        } catch (Exception $e) {
            $responseMessage = 'Mesajınız iletilemedi. Hata: ' . htmlspecialchars($e->getMessage());
        }
    }
    include "header.php";
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>İletişim</title>
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
        <style>
            #map { height: 400px; width: 100%; }
    
            /* Popup Message Styles */
            #popup-message {
                position: fixed;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background-color: #fff;
                padding: 20px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                z-index: 1000;
                display: <?php echo !empty($responseMessage) ? 'block' : 'none'; ?>;
            }
    
            .popup-content {
                text-align: center;
            }
    
            .popup-content p {
                margin-bottom: 20px;
            }
    
            .popup-content button {
                padding: 10px 20px;
                background-color: #007bff;
                color: #fff;
                border: none;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <!--Start breadcrumb area paroller-->
        <section class="breadcrumb-area">
            <div class="breadcrumb-area-bg" style="background-image: url(assets/images/breadcrumb/breadcrumb-1.jpg);"></div>
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="inner-content">
                            <div class="breadcrumb-menu" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="1500">
                                <ul>
                                    <li><a href="index.php">Ana Sayfa</a></li>
                                    <li class="active">İletişim</li>
                                </ul>
                            </div>
                            <div class="title" data-aos="fade-up" data-aos-easing="linear" data-aos-duration="1500">
                                <h2>İletişim</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--End breadcrumb area-->
    
        <!--Start Google Map Style2 Area-->
        <section class="google-map-area">
            <div class="auto-container">
                <div class="contact-page-map-outer">
                    <!-- Google Maps iframe -->
                    <iframe
                        src="link"
                        width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
                            
                            </div>
                    </iframe>
                    <!-- Contact Information Box -->
                </div>
            </div>
        </section>
        <!--End Google Map Style2 Area-->
    
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row">
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-info-box">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Dokun ve bizimle iletişime geç!</h3>
                                </div>
                                <h2>İletişim Seçeneklerimiz</h2>
                            </div>
                            <div class="contact-info-list">
                                <ul>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-telephone"></span>
                                        </div>
                                        <div class="text">
                                            <p>Telefon ile iletişime geç.</p>
                                            <h4><a href="tel:+905380320786">+(90) 538 032 07 86</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-email-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>E-posta Gönder</p>
                                            <h4><a href="mailto:info@geridonusum.com">info@geridonusum.com</a></h4>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="icon">
                                            <span class="icon-pin-1"></span>
                                        </div>
                                        <div class="text">
                                            <p>Konumumuzu ziyaret edin</p>
                                            <h4>Adres</h4>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
    
                    <div class="col-xl-6 col-lg-6">
                        <div class="contact-form contact-form--style2">
                            <div class="sec-title">
                                <div class="sub-title">
                                    <h3>Mesaj Gönder</h3>
                                </div>
                                <h2>Bize Bir Mesaj Gönder</h2>
                            </div>
    
                            <form id="contact-form" name="contact_form" class="default-form2" method="post" action="">
                                <div class="row">
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_name" id="formName" placeholder="İsim Soyisim" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="email" name="form_email" id="formEmail" placeholder="Eposta Adresi" required="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_phone" id="formPhone" placeholder="Telefon Numarası">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <input type="text" name="form_subject" id="formSubject" placeholder="Konu">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <div class="input-box">
                                                <textarea name="form_message" id="formMessage" placeholder="Mesajınız..."></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xl-12">
                                        <div class="form-group">
                                            <button class="btn-one" type="submit" data-loading-text="Please wait...">Mesaj Gönder</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <!-- Popup Message -->
                            <div id="popup-message">
                                <div class="popup-content">
                                    <p><?php echo htmlspecialchars($responseMessage); ?></p>
                                    <button onclick="closePopup()">Kapat</button>
                                </div>
                            </div>
                        </div>
                    </div>
     
                </div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
    
        <script>
            // Function to show the popup
            function showPopup() {
                document.getElementById('popup-message').style.display = 'block';
            }
    
            // Function to close the popup
            function closePopup() {
                document.getElementById('popup-message').style.display = 'none';
            }
    
            // Show popup if response message exists
            <?php if (!empty($responseMessage)) { ?>
                showPopup();
            <?php } ?>
        </script>
    
    </body>
    </html>
    şunu deneyin hocam son olarak
    teşekkür ederim hocam halloldu