comment form

 
Post new topic   Reply to topic    Aprelium Forum Index -> Web Design
View previous topic :: View next topic  
Author Message
mitchsb
-


Joined: 22 Jul 2007
Posts: 27
Location: Torranc, CA

PostPosted: Sun Jul 06, 2008 7:28 pm    Post subject: comment form Reply with quote

Hey all, this may seem a little basic, but I'm having problems with setting up a comment form on my web site.

I know how to do a form, but I can't get the information to submit directly to MY email address. Instead, when somebody (me) puts in the information, an email client launches.

Now, I have read around a bit and I've found various webmail servers and and some scripts to do this, but most of them are rather complicated and all I want to do is set up ONE form so people can comment on my website AND have it set up so that the submit button automatically sends me an email with the form data.

What is the easiest and quickest way to do this?
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
p3
-


Joined: 17 Jun 2005
Posts: 615

PostPosted: Mon Jul 07, 2008 6:59 am    Post subject: Reply with quote

The easiest way (in my opinion, anyway), would just be to use a simple form and a PHP script to shoot the email off. Form:
Code:
<form action="sendemail.php" method="post">Subject: <input type="text" name="subject" /><br />
Message:<br />
<textarea rows="6" cols="80" name="message"></textarea><br />
<input type="submit" name="submit" value="Send Email" />
</form>

And the PHP
Code:
<?php
$email = 'youraddress@example.com'; //Edit me
if(empty($_POST['subject']) || !isset($_POST['subject']) || empty($_POST['message']) || !isset($_POST['message']))
{
die("One or more fields was not filled. Please go back and complete the form.");
}
else
{
mail($email, $_POST['subject'], $_POST['message']);
echo 'Your message has been sent.';
}
?>

Also, what's with all the lesbian CENSORED? There's about a dozen ways to stop the robots with phpBB2 (I remember hearing you guys say you were working on a custom solution, but no signs as of yet ;) )
Back to top View user's profile Send private message Send e-mail
pkSML
-


Joined: 29 May 2006
Posts: 881
Location: Michigan, USA

PostPosted: Fri Jul 18, 2008 7:11 pm    Post subject: Reply with quote

I know this is answering your question a little late, but here is a solution I use. See: http://pksml.net/redirect.php?page=gmail_php

It's a script that will take information from a contact form and send an email through Gmail to your address.

Note that the email may wind up in your spam folder until you add the sending Gmail address to your address book.
_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
mitchsb
-


Joined: 22 Jul 2007
Posts: 27
Location: Torranc, CA

PostPosted: Fri Jul 18, 2008 8:55 pm    Post subject: Reply with quote

Looks like a great solution. I'll try this once I get PHP to work properly.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
DonQuichote
-


Joined: 24 Dec 2006
Posts: 68
Location: The Netherlands

PostPosted: Sat Jul 19, 2008 8:42 am    Post subject: Hacking Reply with quote

The given form is really simple. So simple, in fact, that all hackers (and bots!) passing by will gladly abuse it for spamming. Please do a net search for "header injection" or "email injection" to see why.

If you are going the PHP way, just see if you can find some open source contact form or at least validate the inputs (the subject field is the most important here).
Back to top View user's profile Send private message
JaturontThan
-


Joined: 29 May 2008
Posts: 3

PostPosted: Mon Aug 11, 2008 8:46 am    Post subject: Reply with quote

You also have to save the comments into a text file or put it into the database to keep it. Otherwise it will just show the comment and never be saved.
_________________
Cosmetic Surgery Thailand
Plastic Surgery Thailand
Back to top View user's profile Send private message
swissboney3
-


Joined: 02 Jul 2005
Posts: 31

PostPosted: Mon Aug 11, 2008 10:33 pm    Post subject: Reply with quote

if youre gonna put it into a database, make sure you use mysql_real_escape_string($var-to-escape). this stops attempts at mysql injections. read up on mysql injection attacks on the net...dangerous things
Back to top View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Web Design All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group