TUTORIALS SUBMENU ---->

PHOTOSHOP    FLASH    ILLUSTRATOR    BLENDER    CINEMA 4D    WEB-CODING

Contact Forms


Last 5 User Comments

view entire thread

User:  Hooch (#23671)
Date: Tue Feb 07, 2006. 00:28:47

Post #3 of 3

This looks like a great form 72.
Now how do I implement this? I copied the whole code and made the contact.php file.
Since I can't directly link to it..I changed the name to contact1.php. I then could see the page, and I got it to send an email. But ofcourse the link back didn't work.
So how does this work with my site?
The main page will be an html.
I hope I am clear enough.
TY, Hooch

Reply to this post


User:  scrowler (#19667)
Date: Mon Oct 31, 2005. 10:09:36

Post #2 of 3

why not write this up as an "advanced contact forms" tutorial and submit it?

Reply to this post


User:  72dpi (#18222)
Date: Fri Sep 02, 2005. 08:09:13

Post #1 of 3

Here is the same method that I use,
It also includes a autoresponse.

just change the content as needed.





Untitled Document




// keep people from accessing this page directly
if (eregi('contact.php', $_SERVER['PHP_SELF'])) {
// go to index page
header('Location: ../main.php?page=contact');
die();
}

?>

Contact Form


echo "

* Denotes required fields.

";

// put your email here
$send_to = "youremail@your.com";

// This is what is displayed in the email subject line
$subject = "Message from Your Website";

// This is displayed if all the fields are not filled in
$empty_fields_message = "

Please go back and complete all the fields in the form!

";

// This is displayed when the email has been sent
$thankyou_message = "

Thankyou. Your message has been sent! =)

<< Back to Main

";

// set up info
$nowDay=date("m.d.Y");
$nowClock=date("H:i:s");
$http_referrer = getenv( "HTTP_REFERER" );

// You do not need to edit below this line

$name = stripslashes($_POST['txtName']);
$email = stripslashes($_POST['txtEmail']);
$phone = stripslashes($_POST['txtPhone']);
$message = stripslashes($_POST['txtMessage']);

if (!isset($_POST['txtName'])) {

?>



Name: *


Email: *



Phone:



Contact?



Yes


No

How did you find us?


Advertisement

Word of Mouth

Search Engine

Web Link

Other

Message: *



 



}
elseif (empty($name) || empty($email) || empty($message)) {

echo @$empty_fields_message;
}
else {
// Stop the form being used from an external URL
// Get the referring URL
@$referer = $_SERVER['HTTP_REFERER'];
// Get the URL of this page
@$this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
// If the referring URL and the URL of this page don't match then
// display a message and don't send the email.
if ($referer != $this_url) {
echo "You do not have permission to use this script from another URL.";
exit;
}
@$messageproper =

// we now generate a nice form for emailing
"Message recieved: $nowDay at $nowClock:\n\n" .
"Email Sent From: $http_referrer\n\n" .
"Name: $name\n\n".
"Email: $email\n\n".
"Phone Number: $phone\n\n".
"Contact?: $contact\n\n".
"Found site By: $found\n\n".

"------------------------ COMMENTS ------------------------\n\n\n" .

$message .

"\n\n\n----------------------------------------------------------\n" ;
// The URLs matched so send the email
mail($send_to, $subject, $messageproper, "From: $name <$email>");

# Autoresponder #############################################################
// note , the . (dot) joins two strings. to end a string, use semi-colon ;
$replysubject =
"Query from Your Website" ; // send our subject header
$replymessage =
"Dear " .
$name .
"\n\nThank you for your email. \nIf you had so requested, we will get back to you as soon as possible. " .
"\n\nRegards," .
"\n Your Name Here" .

mail( "$email", "$replysubject", "$replymessage\n\n", "From:$send_to" );
// Display the thankyou message
echo $thankyou_message;

}

?>





Hope it helps

Reply to this post


--- View Entire Thread ---


FEATURED TUTORIALS & GUIDES

view all

DuoTones
DuoTones
- Adobe Photoshop -
Turbulent Water
Turbulent Water
- Adobe Photoshop -
Understanding Levels
Understanding Levels
- Adobe Photoshop -
Holiday Wreath
Holiday Wreath
- Adobe Illustrator -

Username:
Password:  
Remember Me

Lost Password? || Register

  
Download Source File
Printer Friendly Version
Tell A Friend v2.0
   
TrentonCS
Author: ahstanford
Posted: Nov 06th, 7:40pm
Activity: 3 replies, 28 views
Html 5
Author: ahstanford
Posted: Nov 05th, 1:32pm
Activity: 5 replies, 90 views
What are your favorite websites?
Author: ahstanford
Posted: Nov 05th, 12:51am
Activity: 0 replies, 47 views
What do you do for a living?
Author: ahstanford
Posted: Nov 04th, 11:04pm
Activity: 0 replies, 46 views
What is your favorite Subway sandwich?
Author: ahstanford
Posted: Nov 04th, 11:02pm
Activity: 4 replies, 90 views
Windows 7
Author: ahstanford
Posted: Nov 04th, 10:59pm
Activity: 0 replies, 50 views
Google Wave
Author: ahstanford
Posted: Nov 04th, 10:52pm
Activity: 0 replies, 60 views
University Project
Author: Gjbphp
Posted: Nov 03rd, 8:59pm
Activity: 1 replies, 91 views
Hello BioRust!
Author: ahstanford
Posted: Nov 02nd, 5:39pm
Activity: 4 replies, 88 views
 Illustrator cs4 - Convert outlines/graphics to ...
Author: izidrew
Posted: Oct 29th, 3:48pm
Activity: 3 replies, 264 views
Hello BioRust!!
Author: MOST
Posted: Oct 29th, 12:52am
Activity: 4 replies, 144 views
Hey! newbie
Author: prelimiting
Posted: Oct 28th, 11:51pm
Activity: 1 replies, 114 views
--- Site Resources ---
Total Tutorials:212
Total Downloads:    415
Linkbase Links:

Design & Content © BioRUST 2009 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT