0

In the code I wrote below, when I click on the submit button, it downloads the iletişim.php file, it does nothing else, I don't know why.

PHP

<!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>Document</title>
    <link rel="stylesheet" type="text/css" href="iletişim.css">
</head>
<body>
    <?php
    if(!empty ($_POST["submit"])){
        $Username = $_POST["Username"];
        $Useremail = $_POST["Useremail"];
        $userMessage = $_POST["userMessage"];
        $toEmail = $_POST["efealiazad@gmail.com"]
        
        $mailHeaders = "Name:" . $Username .
        "\r\n Email:" . $Useremail .
        "\r\n Message:" . $userMessage . "\r\n";
    }
    if(mail($toEmail, $Username, $mailHeaders)){
        $message = "Bilgileriniz Başarıyla Alındı"
    }
    ?>

        
        <form>
               <div class="araka slide-left">
                <div class="DS"><h3>Destek Sistemi</h3></div>
                <input type="text" id="name" name="Username" class="contact-form-text" placeholder="Adınız/soyadınız" required>
                <input type="email" id="email" name="Useremail" class="contact-form-text" placeholder="E-Posta Adresiniz" required>
                <textarea name="userMessage" id="" cols="30" rows="10" class="contact-form-text" placeholder="Sorununuz nedir kısaca özetleyin" required></textarea>
                <input type="submit" value="submit" name="Gönder" class="contact-form-text-btn submit">
        </form> 
       
</body>
</html>

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">
    <link rel="stylesheet" href="iletişim.css">

    <title>İletişim Bilgileri|Ad</title>
    <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
    
    <div class="header">
        <nav>
            <div class="logo">
                <img src="images/logo.png">
                
            </div>
            <ul>
                <li><a href="index.html">ANA SAYFA</a></li>
                <li><a href="#">HESAP SATIN AL</a>
                    <ul class="submenu">
                        <li><a href="hesapsatınal.html#valorant" class="valorant">Valorant</a></li>
                        <li><a href="hesapsatınal.html#steam">Steam</a></li>
                    </ul>
                </li>
                <li><a href="iletişim.html">BİZE ULAŞIN</a></li>
                <li><a href="sözleşme.html">KULLANICI SÖZLEŞMESİ</a></li>
                <li><a href="FAQ.html">FAQ</a></li>
            </ul>
        </nav>
        <div class="sözls">
        <div class="skosul slide-left">  
        
    <form class="contact-form" action="iletişim.php">
           <div class="araka slide-left">
            <div class="DS"><h3>Destek Sistemi</h3></div>
            <input type="text" id="name" name="name" class="contact-form-text" placeholder="Adınız/soyadınız" required>
            <input type="email" id="email" name="email" class="contact-form-text" placeholder="E-Posta Adresiniz" required>
            <textarea name="" id="" cols="30" rows="10" class="contact-form-text" placeholder="Sorununuz nedir kısaca özetleyin" required></textarea>
            <input type="submit" id="" name="submit" class="contact-form-text-btn submit">
    </form> 
</div>
</body> 
</html>

I listened and wrote these php codes from a youtube tutorial video (except html) All I expect is that it doesn't download this php file and it doesn't run the content of the php code. Also, I don't have a domain name and hosting, could it be because of that?

Unsullied
  • 11
  • 2
  • Do you have a web server with PHP installed and configured, because without one, PHP wont run – RiggsFolly Nov 01 '22 at 16:13
  • What specifically do you mean by "downloads the PHP file"? Is the browser navigating to that page and you can see the PHP code in the page source of the browser? Is it triggering the browser's actual file download functionality (and either saving the file or prompting to save it)? Something else? How are you accessing the page in the first place, what is the URL you are using? – David Nov 01 '22 at 16:15

0 Answers0