Help - HTML Form on my website not working
Hi, very new to this, just put my first website online today via justhost.com designed using their template.
Added a form onto a contact page using html, looks spot on, code i have used at start is <form action="MAILTO:info@
when i click send a box opens up saying something along the lines of the person recieving will see your email address but iclick yes and nothing happens and i dont receieve the form to the email.
can anyone help or suggest a better free way so i receive the info to the email.
much appreciated
greg posted this at 19:05 — 17th March 2009.
He has: 1,581 posts
Joined: Nov 2005
Hi, welcome to TWF
I edited your post to wrap the mailto code in the forum's code tags. They can be found along the top of the posting window (third from the right) along with some other useful tools.
You are better off using EITHER the
MAILTO
on its own, without a<form>
, or using a form.The latter being the best method as using
MAILTO
these days can bring you more spam than having a captcha on a form will.So, you want to POST the form data to another page, then get the form data and use it to send yourself the email.
This is done like this
<form action="second_page.php" method="POST">
Then the user pressing "submit" will send the data to "second_page.php" which will process all the data they entered.
You will need a basic usage of PHP (or other server side), but the major advantage to this is you can check it for errors and blank inputs where fields are required, like user email address can't be blank or how can you reply to them?
If you want us to help with your current code you will have to show us all of it, and link to the site if possible.
If of course you need more info about forms and how to use them, there are some good tutorials already on the net (google html form etc), so take a look at them first, and if you get stuck just ask.
decibel.places posted this at 00:51 — 18th March 2009.
He has: 1,494 posts
Joined: Jun 2008
The mailto href is one of my pet peeves!
People will click on the link, and unless they have configured a default email client (I have - Thunderbird) Windows users are likely to see a configuration script that they don't understand and by then they have forgotten what they want to email you about...
I posted a basic PHP email form here as a project - feel free to give it a spin!
greg will tell you it does not check for errors and blank inputs... well, it's basic.
prasanthmj posted this at 17:28 — 19th March 2009.
They have: 2 posts
Joined: May 2007
The following link gives an overview of different options you have:
How to get email from an HTML form submission
Also try the cgi form mail example
email form how to's
PHP form handling
greg posted this at 18:01 — 19th March 2009.
He has: 1,581 posts
Joined: Nov 2005
Good tutorial
Descriptive and covers all bases.
One thing I would add to your code in your tutorial is the default headers to identify your data and server correctly. Really you should have at least the MIME and content-type.
<?php
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $email\r\n";
$headers .= "X-Mailer: PHP v".phpversion()." \r\n";
?>
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.