FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Form To Mail Script





Devang
Dear Folk

I am in search for a script with which I can receive all my datas of form to my email address.

I searched for this in Google and got number of CGI, PHP, Perl scripts but due to lack of knowledge, I just couldn't go ahead.

I need sort of step by step tutorial on this matter.

Looking forward to help.
thnn
Here is a very basic tutorial.

http://www.thesitewizard.com/archive/feedbackphp.shtml

This is a slightly more advanced one

http://www.thesitewizard.com/archive/phptutorial2.shtml
BlackSkad
Well, google still is useful with the correct keywords.
Take a look at this tutorial: PHP Tutorial: Writing Your First PHP Script: Feedback Form Script This shows you the very, very basic from mailing form results (As the form has only 1 real message-field.
If you have more fields in your form that need to be in the message, you can "concatenate" or glue them togheter like this:
Code:
$value1 = $_REQUEST['field1'];
$value2 = $_REQUEST['field2'];
$message = "value 1: " . $value1 . "\nValue 2: " . $value2;


There's also a second part on this tutorial: http://www.thesitewizard.com/archive/phptutorial2.shtml

If you have more question, don't hesitate, just ask Wink

Greatz,
BlackSkad

EDIT: Gosh, I'm way to slow Very Happy
dandelion
Well, just write the script from scratch. Smile
Code:
<?php

$to = 'me@example.com';
$subject = 'Form Data Submitted';
$message = '';

foreach ($_POST as $field => $value) {
    $message .= "$field: $value\n";
}

mail($to, $subject, $message);

?>

Be sure your form method is set to 'post'.
BlackSkad
If anyone finds out you use this script, you might be hacked in no time. Do some more checking on the input if you want to use Dandelions way... You never know what someone puts in it...
DX-Blog
Indeed, try reading this:
http://securephp.damonkohler.com/index.php/Email_Injection


Btw, be friendly to the email client and include $headers, at least give it a From: header if you don't want to do any additional.
Related topics
form mail for php
A Simple Form Mail in PHP
Simple and Detailed Mail Script
Looking for easy FormMail Script
I need PHP script
Server Changes Since Crash?
Please Help? CGI form mail on my site... only 2 questions!
Form Mail Help Needed
form mail problems (quality help=frih$)
[man]Form Mail en PHP
Need help with submitting form
anyone know of a good php form processer script
Help required with Captcha script
Need Help. Post - Mail script failure
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.