First, let's create the html section. I made a simple form, but it gets the job done. You can customize it if you want, but remember to use the same form variables.
<form action="<?=$file_location;?>" method="post"> |
Now, for the PHP code, which should be placed above the HTML section.
This will be the first part of your code, which will, in term, determine if the form is being processed.
The isset function checks to see if the variable exist, this function has various alternatives.
| <?php if(isset($hidden)){ |
After, if the form is indeed processed, check for all the variables using the isset function. You can alter the message in the echo, if you feel like it. =)
if(!isset($from) or !isset($subject) or !isset($message)) { |
We can finally use the mail function. Change the $to variable to your email address. Once again, you can edit the message in the echo!
else { |
Final:
<?php <form action="<?=$file_location;?>" method="post"> |
Enjoy !
Related Articles
- How to make a simple form mailer with PHPAs you may be well aware, displaying your e-mail address on your website can lead to e-mail harvesters picking up your address and adding it to hundreds or even thousands of lists used by spammers...
- Form HandlingWe are going to be working with the $_Post or $_Get arrays. They basically tell the form if i needs to post something, or get something. In this case we are going to be showing you the basics of a contact email form, so we will be using the $_Post array.
- PHP Contact FormFirst, lets create the html section. I made a simple form, but it gets the job done. You can customize it if you want, but remember to use the same form variables.
- The Importance of Having a Feedback Form in Your E-commerce WebsiteInternet marketing is a different ball game altogether when compared to traditional marketing. A brick and mortar store employs salespersons to guide and advise its customers. No such equivalent of a salesperson exists for an online store. This could be one of the reasons why people shy away from on...
- Contact FormHere I will explain to you how you can create a simple contact form. The form will collect data from the visitor and send it to any email address you please. The only requirement for this tutorial is for you to have .php enabled on your server. If you dont want to read through the whole tutorial a....
- Form EmailLearn to send mail with the php mail(); function.
- E-mail form using HTML and PHPSometimes its a nice touch to include an e-mail feedback form on your contact page or elsewhere on your web site. Lets create an e-mail form using html and a simple php script to send it along.
- How to Implement the CAPTCHA with PHP and GDThis article is a gas, it will show you How to Implement the CAPTCHA with PHP and GD. All the necessary code is laid out nice and neat by the author who has also provided you with helpful graphics to make it easy to understand.
- Good 24/7 Hosting Customer Support -- Is It Possible?Even if you are an experienced webmaster you will need to contact the support team time from time in order to solve problems which can be either on your side or web hosting company side...
- Domain Names - Free Privacy - How to Protect your Privacy When You Register a Domain NameAre you worried about your privacy online when starting a website? You should be. When you register domain names - free privacy settings from your registrar can protect you from spam, prying eyes, or worse.
