A
A
Alexander Bagirov2014-06-29 12:19:22
PHP
Alexander Bagirov, 2014-06-29 12:19:22

How to set up a PHP Sendmail form?

Hello!
At the end of the page, I have a form to send an email to.
Her code:

<form id="contact-form" class="bl_form text-center" action="contact.php" method="post" novalidate>
<span class="field-wrap scrollimation fade-right">
<label class="control-label" for="contact-name">Name</label>
<input id="contact-name" name="contactName" type="text" class="label_better requiredField" data-new-placeholder="Name" placeholder="Name" data-error-empty="*Enter your name">
</span>
<span class="field-wrap scrollimation fade-in">
<label class="control-label" for="contact-mail">Email</label>
<input id="contact-mail" name="email" type="email" class="label_better requiredField" data-new-placeholder="Email Address" placeholder="Email Address" data-error-empty="*Enter your email" data-error-invalid="x Invalid email address">
</span>
<span class="field-wrap scrollimation fade-left">
<label class="control-label" for="contact-message">Message</label>
<textarea id="contact-message" name="comments" rows="1" class="label_better requiredField" data-new-placeholder="Message" placeholder="Message" data-error-empty="*Enter your message"></textarea>
</span>
<p class="text-center"><button name="submit" type="submit" class="btn btn-meflat icon-left" data-error-message="Error!" data-sending-message="Sending..." data-ok-message="Message Sent"><i class="fa fa-location-arrow"></i>Send Message</button></p>
<input type="hidden" name="submitted" id="submitted" value="true"/>
</form>

It turns out that it sends data to contact.php. I have read about the mail() function .
What should I specify in contact.php to send an email?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bahek2462774, 2014-06-29
@alexbagirov

each field in the form with a name
here name="email" - this defines the name of the variable in PHP = $_REQUEST['email']
You need to get all the variables you need in your contact.php and do whatever you want with them. If you want, send mail() , but if you want, write it to the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question