Contact form question

This is a discussion on "Contact form question" within the PHP Forum section. This forum, and the thread "Contact form question are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 14th, 2007, 15:26
New Member
Join Date: Mar 2007
Location: North Carolina
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Formmail.pl

I'd also like some help on this if you don't mind lol. I've been readint through this thread because I'm trying to setup a couple forms on my website as well. I want the info to be sent to my e-mail and for the person submiting the form to be sent to a page telling them that their info was sent (as well as sending them a confirmation e-mail if possible, but that's not as big of an issue). I've tried several methods for this, including download the formmail.pl file off of Matt's script archive - http://www.scriptarchive.com - but I'm too much of a n00b to really understand the README file, so I'm having difficulties figuring out what exactly I'm suppose to edit to configure the file, and what exactly I'm suppose to edit it to :P.

I've also tried the PHP method and I uploaded a form to test it out, but when I hit submit all it does is it takes me to the FormToEmail.php page, which is just a blank document, and doesn't do anything or redirect me anywhere. :\ Any thoughts on what might be the cause of that?
Reply With Quote

  #2 (permalink)  
Old Mar 14th, 2007, 15:29
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Formmail.pl

Here's a PHP Contact Script I've suggested on here before.

There are also quite a few threads on the subject already in the forum so you might want to search for those and see what people have used.

Last edited by karinne; Mar 14th, 2007 at 15:33. Reason: Added more info.
Reply With Quote
  #3 (permalink)  
Old Mar 14th, 2007, 15:46
Reputable Member
Join Date: Mar 2007
Location: Kenya
Age: 19
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to geyids Send a message via Yahoo to geyids Send a message via Skype™ to geyids
Re: Formmail.pl

the joe2torials didnt comeout as I wanted this worked as I wanted. I think Solitary Soul you better have some time and go thro' this but im sure it works good
PHP: Select all

<?php
/*
DESCRIPTION
FormToEmail allows you to place a form on your website which your visitors can fill out and send to you. The contents of the form are sent to the email address which you specify below. The form allows your visitors to enter their name, email address and comments. If they try to send a blank form, they will be returned to the form.
Your visitors (and nasty spambots!) cannot see your email address!  The script cannot be hijacked by spammers.
When the form is sent, your visitor will get a confirmation of this on the screen, and will be given a link to continue to your homepage, or other page if you specify it.
Should you need the facility, you can add additional fields to your form, which this script will also process, without making any additional changes.
This is a PHP script. In order for it to run, you must have PHP (version 4.1.0 or later) on your webhosting account. If you are not sure about this, then please ask your webhost about it.
SETUP INSTRUCTIONS
Step 1: Put the form on your webpage
Step 2: Enter your email address and continue link below
Step 3: Upload the files to your webspace
Step 1:
To put the form on your webpage, copy the code below as it is, and paste it into your webpage:
<form action="FormToEmail.php" method="post">
<table border="0" bgcolor="#ececec" cellspacing="5">
<tr><td><font face="arial" size="2">Name</font></td><td><input type="text" size="30" name="Name"></td></tr>
<tr><td><font face="arial" size="2">Email address</font></td><td><input type="text" size="30" name="Email"></td></tr>
<tr><td valign="top"><font face="arial" size="2">Comments</font></td><td><textarea name="Comments" rows="6" cols="30"></textarea></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Send"><font face="arial" size="1">&nbsp;&nbsp;FormToEmail by <a href="<A href="http://FormToEmail.com">FormToEmail.com</a></font></td></tr">http://FormToEmail.com">FormToEmail.com</a></font></td></tr>
</table>
</form>
Step 2:
Enter the email address below to send the form to:
*/
$my_email "delete these words and put the email address only in here between the quotes";
/*
Enter the continue link to offer the user after the form is sent. If you do not change this, your visitor will be given a continue link to your homepage:
If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"
*/
$continue "/";
/*
Step 3:
Save this file (FormToEmail.php) and upload it together with your webpage to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above! Do not put this script in your cgi-bin directory (folder) it may not work from there.
THAT'S IT, FINISHED!
You do not need to make any changes below this line.
*/
// This line prevents values being entered in a URL
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){print "Please enable referrer logging to use this contact form. Your message was not sent."; exit;}
// Describe function to check for new lines.
function new_line_check($a)
{
if(
preg_match('`[\r\n]`',$a)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
new_line_check($_POST['Name']);
// Check for disallowed characters in the Name and Email fields.
$disallowed_name = array(':',';','"','=','(',')','{','}','@');
foreach(
$disallowed_name as $value)
{
if(
stristr($_POST['Name'],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
new_line_check($_POST['Email']);
$disallowed_email = array(':',';',"'",'"','=','(',')','{','}');
foreach(
$disallowed_email as $value)
{
if(
stristr($_POST['Email'],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$message "";
// This line prevents a blank form being sent, and builds the message.
foreach($_POST as $key => $value){if(!(empty($value))){$set=1;}$message $message "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message $message "-- \nThank you for using FormToEmail from http://FormToEmail.com";
$message stripslashes($message);
$subject "FormToEmail Comments";
$headers "From: " $_POST['Email'] . "\n" "Return-Path: " $_POST['Email'] . "\n" "Reply-To: " $_POST['Email'] . "\n";
mail($my_email,$subject,$message,$headers);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Form To Email PHP script from FormToEmail.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-uk">
</head>
<body bgcolor="#ffffff" text="#000000">
<div>
<center>
<font face="arial" size="2"><b>Thank you <?php print stripslashes($_POST['Name']); ?>!</b>
<br>Your message has been sent</font>
<p><font face="arial" size="2"><a href="<?php print "$continue"?>">Click here to continue</a></font></p>
<p><font face="arial" size="2"><b>FormToEmail</b> by <a href="<A href="http://FormToEmail.com">FormToEmail.com</a></font></p">http://FormToEmail.com">FormToEmail.com</a></font></p>
</center>
</div>
</body>
</html>

Last edited by karinne; Mar 14th, 2007 at 15:48. Reason: geyids: it's [php] not <php> for posting code ;)
Reply With Quote
  #4 (permalink)  
Old Mar 14th, 2007, 16:21
New Member
Join Date: Mar 2007
Location: North Carolina
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Formmail.pl

Quote:
Originally Posted by karinne View Post
Here's a PHP Contact Script I've suggested on here before.

There are also quite a few threads on the subject already in the forum so you might want to search for those and see what people have used.
Thanks, but now I've run into another issue lol. I'm not wanting this form as a seperate page, instead I'm wanting it as a small forum as a division on part of my homepage, or just nested somewhere in an already existing page. I've tried just putting it all inside div tags in the section of my homepage that I already created the form in (just replaced the old form html code with what is in the contact.php file) and renamed it to index.php. Is that what I should do?

I tested it and it threw everything on my homepage out of wack and alignment lol, and also when I try submitting the form and it goes to the thank_you.php file, for some reason it is giving me a File not found error, but I know the file is there.
Reply With Quote
  #5 (permalink)  
Old Mar 14th, 2007, 16:24
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form question

I've moved your post and created a new thread in the php section as it has nothing to do with the previous thread.
Reply With Quote
  #6 (permalink)  
Old Mar 14th, 2007, 16:27
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Formmail.pl

Quote:
Originally Posted by SolitarySoul View Post
I've tried just putting it all inside div tags in the section of my homepage that I already created the form in (just replaced the old form html code with what is in the contact.php file) and renamed it to index.php. Is that what I should do?
Do you have all the php stuff and css too?
Reply With Quote
  #7 (permalink)  
Old Mar 14th, 2007, 17:00
New Member
Join Date: Mar 2007
Location: North Carolina
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form question

Nevermind it's working now

Thanks a bunch for the help.
Reply With Quote
  #8 (permalink)  
Old Mar 14th, 2007, 17:02
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form question

No problem.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP contact form redirect to same form Posie PHP Forum 14 Jan 29th, 2008 20:28
php contact form geyids PHP Forum 5 Jun 14th, 2007 16:59
Contact us form help! NurseJenny PHP Forum 10 Jun 23rd, 2006 13:27
Contact Form Question webdiva22ny PHP Forum 1 Aug 14th, 2005 09:02
Need Quote Form and Contact Form Av8er Flash & Multimedia Forum 5 Oct 30th, 2003 17:14


All times are GMT. The time now is 20:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43