In Feburary 2016 03,
Define the email form in your HTML document by using the 'form' element and specifying the method and action attributes. Here is an example line of the form opening tag: tag.
Create data-entry fields inside the form to meet your needs. It would make sense to have a field for the user to enter his name, email address and his message. You may optionally add other fields. Here is an example of how the HTML would look for a simple email form with those three fields. Remember that all of this goes inside the tags. Notice some of the attributes and their values. You can adjust these values to suit your preferences.
What is your name?
What is your e-mail address?
What is your message?
Create a PHP file to process the e-mail form once the user submits it. In a new document, copy and paste the following, remembering to replace 'your_email_address@provider.com' with your actual e-mail address, and 'comments_received.html' with the URL of the webpage on your site where you want the user to be redirected after she submits the form:// Build the e-mail
$to = 'your_email_address@provider.com';
$from = '$email';
$subject = 'E-Mail Contact Form';
$message =
'$name at $email said:
$message';
$headers = 'From: $email';// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);// Redirect
header('Location: comments_received.html');
Save both files to the same folder on your website. Save the HTML document with the '.php' file extension rather than the usual '.html' one. Save the PHP file with the '.php' extension as well.
In Feburary 2016 03,
Keine Kommentare:
Kommentar veröffentlichen