Old 04-25-2005   1 links from elsewhere to this Post. Click to view. #1 (permalink)
Tech Support
 
Man1c M0g's Avatar
 
Tournaments Won: 1

Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,202
Blog Entries: 21
Images: 3

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
Contact Forms

This is a thread to discuss the Contact Forms tutorial. Please keep all posts on-topic, don't spam, and read the entire thread BEFORE you post - any issues you have could be answered deeper within the thread.
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-02-2005   #2 (permalink)
72dpi
Guest
 

Posts: n/a

Awesome tute

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

just change the content as needed.

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<? 
// 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(); 


?>
<h4>Contact Form</h4>
<?php
echo "<p>* Denotes required fields. </p>";

// 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 "<p>Please <a href='contact.php'>go back</a> and complete all the fields in the form!</p>";

// This is displayed when the email has been sent
$thankyou_message "<p>Thankyou. Your message has been sent! =)<br /><br /><a href='index.php'><< Back to Main</a></p>";

// 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'])) {

?>
</p>
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="mailme" name="mailme">
            Name: <span class="error"> *</span><br />
            <input name="txtName" type="text" title="Enter your name" size="35" maxlength="20"/>
            <p> Email: <span class="error"> *</span><br />
                <input name="txtEmail" type="text" title="Enter your email address" size="35" maxlength="30"/>
</p>
  <p> Phone:<br />
                <input name="txtPhone" type="text" title="Enter your phone number" size="35" maxlength="20"/>
            </p>
            <p>Contact? </p>
            <input name="contact" type="radio" value="yes" checked>
                Yes<br />
                <input name="contact" type="radio" value="no">
                No
            <p>How did you find us?</p>
            <input name="found" type="radio" value="advertisement">Advertisement <br />
            <input name="found" type="radio" value="wordofmouth">Word of Mouth <br />
            <input name="found" type="radio" value="search_engine">Search Engine <br />
            <input name="found" type="radio" value="web_link">Web Link <br />
            <input name="found" type="radio" value="other" checked>Other<br />
            <p> Message: <span class="error"> *</span> <br />
            <textarea name="txtMessage" cols="50" rows="10" wrap="VIRTUAL" /></textarea></p>
            <p>
            <input name="Reset" type="reset" value="Clear"/>&nbsp;
            <input name="submit" type="submit" value="Send"/>
            </p>
          </form>
          <?php
}
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;
    
}

?>

</body>
</html>
Hope it helps
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-31-2005   #3 (permalink)
Registered User
 
scrowler's Avatar
 
Snake Champion!
Join Date: Feb 2004
Location: New Zealand
Posts: 590
Images: 7

Send a message via MSN to scrowler
why not write this up as an "advanced contact forms" tutorial and submit it?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-07-2006   #4 (permalink)
Registered User
 

Join Date: Jan 2006
Posts: 1

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
Hooch is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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


LinkBacks (?)
LinkBack to this Thread: http://forums.biorust.com/tutorial-commenting-system/1667-contact-forms.html
Posted By For Type Date
BioRUST.com :: Tutorials >> Contact Forms This thread Refback 11-19-2007 10:41 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
DB driven contact form? Torner HTML / PHP / ASP / JS 4 08-06-2008 12:36 AM
Contact form help! ecntrc HTML / PHP / ASP / JS 3 01-25-2007 05:11 PM
HTML Help - Forms Neil_8_24_93 HTML / PHP / ASP / JS 2 08-15-2006 01:10 AM
Getting simple CSS contact for to work.. ecntrc HTML / PHP / ASP / JS 9 05-02-2006 07:08 PM


All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2

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