Answer the question
In order to leave comments, you need to log in
Form handler on the site - how to do it?
Hey! Decided to learn from the front-end. - Yes, yes - one more! and this one there!
I'm just interested in this topic, not for making money (at least in the short term).
I laid out the site on flex and grids, I decided to put it on the host, but here's the problem.
I have a form for sending a letter there - name, phone, email, text. I can't attach a handler to it. Rather, I can connect it, but I have already tried 10 pieces, none of them work. I have been suffering with this for three days already - I have already studied everything that was available - letters are not sent.
I ask for help - who has a form handler and who can explain to me how it works and is configured. Or where can I read a good manual on this? all the handlers that I took before - I took advice from Habr.
I don't consider myself particularly stupid, but I can't handle it. I have already tried different handlers, which I found both in JS and PHP, the maximum that I have achieved is form validation and that's it.
At the moment there is a script - it works, I posted it in the comments below, but it's true - with such a handler, I'm even ashamed to post it for myself.
Answer the question
In order to leave comments, you need to log in
First, just write in the text editor what you typed in the form - without sending it via mail.
As the data starts to be saved - set up mail.
1. Take PHPMailer. This is a ready-made PHP module.
2. You look at the guide under it, nothing complicated, your form seems to be already in the example, copy it.
3. Read the documentation, check how mail is configured on your server.
4. You fasten the action of your form towards phpmailer, stupidly a relative link a'la action='/php/sendmail.php'
or absolute action='https://site.ru/php/sendmail.php'
5. You check (it won't work on every dev server on the LAN, so to be sure, it will work right away on the working one)
6. Enjoy life.
7. You think.
8. You eat.
9. What are you.
10. You think of attaching an asynchronous form so that everything is beautiful, you do it.
11. Doubly enjoy life.
PS: read how the form tag and its interior are correctly formed to transfer data to the outside.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question