0

i want to send a form as an email with php but i'm new to php so i tried to take a baby step and figure out how to send an simple email when i click to form's submit button my code down below, when i press the submit button form calls php file but it doesnt sends email and when i try view-source at chrome it shows empty document is it normal or am i doing something wrong? thanks in advance and sorry for bad English.

<?php
$to      = 'abdullahaydogan048@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

<form action="test.php" method="POST" enctype="multipart/form-data" autocomplete="off">
    <div class="col s12 m12 l12">
        <div class="input-field">
            <input type="text" id="name" name="fullname">
            <label for="name">Ad Soyad</label>
        </div>
    </div>
    <div class="col s6 m6 l6">
        <div class="input-field">
            <input type="text" id="mail" name="email">
            <label for="mail">E-Posta</label>
        </div>
    </div>
    <div class="col s6 m6 l6">
        <div class="input-field">
            <input type="number" id="phone" name="phone">
            <label for="phone">Telefon (zorunlu değil)</label>
        </div>
    </div>
    <div class="col s12 m12 l12">
        <div class="input-field">
            <textarea type="text" id="message" class="materialize-textarea" name="message"></textarea>
            <label for="message">Mesaj</label>
            <p class="left">Lütfen mesajınızda cihazınızın arızasını tarif edin ve cihazınızın marka, model bilgilerini eklemeyi unutmayın. </p>
            <p class="left">Marka, model bilgisi en doğru fiyatı hesaplamamız için çok önemli bir detaydır.</p>
        </div>
    </div>
    <div class="col s6" style="margin: 10px 0 10px 0;">
        <input class="btn green white-text" type="submit" name="submit" value="GÖNDER">
    </div>
    <div class="col s6" style="margin: 10px 0 10px 0;">
        <input class="btn red white-text " type="reset" value="TEMİZLE">
    </div>
</form>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

0 Answers0