6, July 2008

Send to e-mail after validation - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Validate_fields Class (Moderator: Olaf)
Topic: Send to e-mail after validation
« previous next »
Pages: [1] Print

Author Topic: Send to e-mail after validation  (Read 1983 times)
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« on: Jun 21, 2006, 12:13:48 PM »

Maybe a simple question, but ok...

How can you let the script send the information given in my form to an e-mail address?

Thanks in advantage...
« Last Edit: Jun 21, 2006, 12:49:05 PM by olaf »
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7931
40535 credits
Members referred : 3



Re: Send to e-mail
« Reply #1 on: Jun 21, 2006, 12:26:19 PM »

I guess this is not a question for the class, but a general php one.

You can email through your script using the function mail Visit through proxy

A simple example of mail is the one bellow :

Code:
<?php
mail
('mail@adress.com''Subject''message');

Trial and Error my two best teachers Cool
Promote your blog for free.... Visit through proxy

Last blog : Keep it Legal - Tims guide to legal notices
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Jun 21, 2006, 12:48:45 PM »

Maybe a simple question, but ok...

How can you let the script send the information given in my form to an e-mail address?

Thanks in advantage...

check the example for this code:
Code:
<?php
if (
$example->validation()) {
// replace this text if you like...


at "//replace..." use this kind of mail script: http://www.finalwebsites.com/snippets.php?id=3 Visit through proxy


Last blog : 4th of July Lottery from TemplateMonster.com
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« Reply #3 on: Jun 21, 2006, 03:01:19 PM »

Can you tell me where I have to place the code?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Jun 21, 2006, 03:02:06 PM »

Can you tell me where I have to place the code?
// replace this text if you like...


Last blog : 4th of July Lottery from TemplateMonster.com
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« Reply #5 on: Jun 21, 2006, 03:36:07 PM »

Parse error: parse error, unexpected T_STRING
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7931
40535 credits
Members referred : 3



« Reply #6 on: Jun 21, 2006, 03:38:30 PM »

Parse error: parse error, unexpected T_STRING

This is a common error. You missed a bracket or something like that ( {}; )

Trial and Error my two best teachers Cool
Promote your blog for free.... Visit through proxy

Last blog : Keep it Legal - Tims guide to legal notices
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Jun 21, 2006, 03:45:46 PM »

Parse error: parse error, unexpected T_STRING
Silver,

start with example of the validation class and the copy / paste the e-mail code.

...post the php code here...


Last blog : 4th of July Lottery from TemplateMonster.com
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Jun 21, 2006, 03:48:09 PM »

the code must look like:

Code:
<?php 
include("validation_class.php");
if (isset(
$_POST['submit'])) {
$example = new Validate_fields;
$example->check_4html true;
$example->add_text_field("Simple_text"$_POST['string'], "text""y");
$example->add_num_field("Number"$_POST['number'], "number""n"05);
$example->add_num_field("Number_with_decimals"$_POST['decimal'], "decimal""n"2);
$example->add_date_field("Euro_date"$_POST['date'], "date""eu""n");
$example->add_check_box("Check_box""check""checkbox");
$example->add_link_field("Email_address"$_POST['email'], "email");
$example->add_link_field("internet_link"$_POST['url'], "url""n");
if ($example->validation()) {
$goto_after_mail "thanks.htm"// this is the page which is shown after the mail is submitted
$from_mail $_REQUEST['from_email'];
$from_name $_REQUEST['from_name']; // use both value's from your form
$header "From: \"$from_name\" <$from_mail>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n";
$subject "Your webform posted at ".date("d-m-Y"); //your mailsubject incl. current date
foreach ($_REQUEST as $key => $val) {
if ($key != "from_email" && $key != "from_name") { //skip, this values are already in the header
$body .= $key " : " $val "\r\n";
}
}
if (mail("you@yourmail.com"$subject$body$header)) {
header("Location: ".$goto_after_mail);

} else {
$error $example->create_msg();
}
}
?>

but there is more to do...but you know that right?


Last blog : 4th of July Lottery from TemplateMonster.com
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« Reply #9 on: Jun 22, 2006, 12:15:45 AM »

Ok thank you very much. I fixed it and now I receive the forms.Smiley

Bedankt! Kiss
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #10 on: Jun 22, 2006, 12:29:06 AM »

you're welcome!


Last blog : 4th of July Lottery from TemplateMonster.com
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=2963
Tags : php email Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Validate_fields Class (Moderator: Olaf)
Topic: Send to e-mail after validation
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 06, 2008, 12:22:53 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.533
Total Topics: 7.344
Total Members: 3.647
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: pawan

14 Guests, 3 Users online :

14 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.