<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<form method="POST" action="mail.php">
<div class="row">
    <div class="col-sm-6">
        <?php echo $company ?>
    </div>
    <div class="col-sm-6">
        <?php echo $city ?>
    </div>
</div>
<div class="row">
    <div class="col-sm-6">
        <?php echo $name ?>
    </div>
    <div class="col-sm-6">
        <?php echo $second_name ?>
    </div>
</div>
<div class="row">
    <div class="col-sm-6">
        <?php echo $phone ?>
    </div>
    <div class="col-sm-6">
        <?php echo $email ?>
    </div>
</div>
<?php echo $message ?>
<div style="font-family: Arial; font-size: 14px; line-height:18px; color: #000000; margin: 0; padding: 0; text-align: justify; text-justify: inter-word;">
<input type="hidden" name="deal" id="deal" value="Nu">
<input type="checkbox" name="deal" id="deal" value="Yes"> I agree.<br>
</div>
<div class="clearfix"><button class="btn-green pull-right" type="submit">Trimite</button></div>
</form>
and the mail.php
nie<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Retrieve data from the form
    $companie = $_POST['company'];
    $localitate = $_POST['city'];
    $nume = $_POST['name'];
    $prenume = $_POST['second_name'];
    $telefon = $_POST['phone'];
    $email = $_POST['email'];
    $mesaj = $_POST['message'];
    // Check if the checkbox is checked
    if (isset($_POST['acord']) && $_POST['acord'] === 'Da') {
        // Construct the email message
        $to = 'test@gmail.com';
        $subject = 'New Maessage';
        $message = "Company: $company\nCity: $city\nName: $name\nSecond_name: $second_name\nPhone: $phone\nEmail: $email\nMessage: $message";
        // Send the email
        if (mail($to, $subject, $message)) {
            echo 'Mail send ok';
        } else {
            echo 'Error sending email';
        }
    } else {
        // Show error message if the checkbox is not checked
        echo 'Please agree with the following';
    }
}
?>
Hello,
I want to sent email using the form bellow but I receive a blank page and I really dont know why. Ive added even the mail.php file and nothing seems to be wrong but I cannot find the bug in order to send an email when I press the Submit button.
I should receive an email on my email address, but I did not receive anything, only a blank page and it`s not ok.
Thank you. Mihaita
