Contact form

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
TomBullock
-


Joined: 30 Jun 2007
Posts: 76

PostPosted: Fri Jul 27, 2007 12:54 am    Post subject: Contact form Reply with quote

Sorry, this may seem off topic or in the forum but does anyone have a basic HTML code that would gather all the info entered into text boxes and send to an e-mail address from my own e-mail address?

Thanks :D
Back to top View user's profile Send private message
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Fri Jul 27, 2007 1:29 am    Post subject: Reply with quote

There are many free ones on the internet, but most likely you will want your form to utilize a server-side language to gather and send the information to you.
_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
TomBullock
-


Joined: 30 Jun 2007
Posts: 76

PostPosted: Fri Jul 27, 2007 1:31 am    Post subject: Reply with quote

How would i do this?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jul 27, 2007 11:56 pm    Post subject: Reply with quote

TomBullock wrote:
How would i do this?


Probably the most famous script that does what you want is in http://www.scriptarchive.com/formmail.html . It requires Perl support ( http://www.aprelium.com/abyssws/perl.html ).
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
lucorium
-


Joined: 26 Feb 2006
Posts: 17

PostPosted: Sun Jul 29, 2007 12:34 am    Post subject: Here's the contact form EXPOSED! Reply with quote

Here's everything you need to make a contact form for your web page.
Three things are necessary:

1- Abyss with PHP installed AND your email configured on the PHP.ini file which is located on the PHP directory where you installed PHP server.
2- You need to put together a web page with a form. Here you need to make sure you save your files with .php extension like example.php instead of example.html
3- Also, you need a php file that handles the info from that form and send it to your email in a readable format AND to show the user that the message has been sent. That page you will create in step 2 with the form will call this last file to do the job.

Here's how you do all that:

1- Go to http://abyssunderground.co.uk/tutorials.php to install abyss web server and to install PHP

2- Create a new new text file and copy the following code in it. Make sure you save the file exactly like this sendemail.php. BE CAREFUL it will be useless if you save it as sendemail.php.txt
This is the file that is gonna handle the data from the form and send it to your email AND show the user the message has been sent.
Also, look into the code where it says "your-email@your-email.com" and replace it with the email you want the info to be sent to.
Code:
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
        <!-- Reminder: Change 'YourEmail' to Your real email -->
        <?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}

if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("your-email@your-email.com", $subject, $message, $from);

?>
        <p align="center"> Date: <?php echo $todayis ?> <br />
          Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br />
          Attention: <?php echo $attn ?> <br />
          Message:<br />
          <?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>


3- Now, create another text file and copy the following code in it. This will be your contact form and you can name it however you want BUT with a .php extension.
Code:

<div>
      <h3>
        <form method="post" action="sendemail.php">
          <!-- DO NOT change ANY of the php sections -->
          <?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
          <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
          <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
          <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
          Your Name: <br />
          <input type="text" name="visitor" size="35" />
          <br />
          Your Email:<br />
          <input type="text" name="visitormail" size="35" />
          <br />
          <br />
          <br />
          Attention:<br />
          <select name="attn" size="1">
            <option value=" No Selection">Select...</option>
            <option value=" Customer Needs Support ">I Need Computer Support </option>
            <option value=" Customer Needs Quote ">I need a quote </option>
            <option value=" Customer Suggestion ">Suggestion Dropbox</option>
            <option value=" Webmaster ">Webmaster </option>
          </select>
          <br />
          <br />
          Mail Message: <br />
          <textarea name="notes" rows="4" cols="40"></textarea>
          <br />
          <input name="submit" type="submit" value="Send Mail" />
          <br />
        </form>
         </h3>
    </div>


4- Now, upload the 2 files you just created into the web server with PHP server installed and functioning.
Call the contact.php file from the browser like www.yourdomain.com/contact.php and test it out!

5- It is critical you configure the php.ini file in order for this to work.
Go to the directory you installed php and look for the php.ini and open it with notepad.
Scroll down, approximately to the half of the document looking for a line that says "email smtp port 25" (or something like that) and add your smtp server. In my case I had replace the example with mail.bellsouth.net as my smtp. When you're done SAVE it and close it.

That's it. I want to add that I did NOT create this code. I took it from the internet a while ago and I don't know who to give the credit.
However I'm using it and works like a charm.
I hope this info is useful to you and makes up for the lousy title :s

Lucas.


Last edited by lucorium on Sun Jul 29, 2007 12:45 am; edited 1 time in total
Back to top View user's profile Send private message
lucorium
-


Joined: 26 Feb 2006
Posts: 17

PostPosted: Sun Jul 29, 2007 12:34 am    Post subject: Reply with quote

Once you tested it, feel free to modify it however you want.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions 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