M
M
Mark_Light2021-06-08 21:21:16
PHP
Mark_Light, 2021-06-08 21:21:16

How to put the execution of the php script through the form?

Good afternoon! Let's get straight to the point:
There is this code:

<form action="mail/mail.php" method="post" >
                        <div class="input-dark">
                           <i style="font-size:24px" class="fa">&#xf095;</i>
                            <input type="text" name="phone1" value="" placeholder="Введите номер телефона" data-mask="phone" />
                        </div>
                        <input type="submit" value="Получить расчет" />
                    </form>


When filling out the form and submitting it, the php script is executed:

<?PHP
    $phone = $_POST['phone1'];

    
   $phone = htmlspecialchars($phone);


   $phone = urldecode($phone);

  
   $phone = trim($phone);

  
mail("[email protected]", "Новая заявка", " Телефон: ".$phone.") or die("Error");

header('Location: https://i.imgur.com/yTjeLaN.jpg');
?>


It seems that everything should work, but after filling out the form and sending it, it redirects to an empty page domain/mail/mail.php (directory of the script itself)
What could be the problem? Tell good people)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question