I
I
Ibishka2020-05-04 22:39:28
PHP
Ibishka, 2020-05-04 22:39:28

Do I need to fill in form attributes?

<form class="contacts__form" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST">
        <input type="email" name='email' class="contacts__form-elem" placeholder="Enter Email" required>
        <input type="tel" name="tel" class="contacts__form-elem" placeholder="Phone" required>
        <textarea name="msg" class="contacts__form-elem" placeholder="Message" required></textarea>
        <button type="submit" name="submit" class="contacts__submit submit btn">
          Contact US <i class="fas fa-chevron-right"></i>
        </button>
      </form>

On submit in js, I write e.preventDefault() and make a post request in send.php from there to receive a response that the email was sent or not. At the same time, is it necessary to fill in the attributes of the action method form of the type protection against various attacks through forms?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2020-05-04
@Ibishka

type of protection against various attacks through forms?
for this tokens are used.
At the same time, whether it is necessary to fill in the attributes of the action method form
It is not particularly important, if the server has a method check and the request url will not process the left data, then everything is ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question