Go Back   CP Web Hosting - reseller hosting > Server Scripting > ASP
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-26-2007, 08:07 AM
Senior Member
 
Join Date: May 2007
Posts: 329
Default send the data from forms to emails

hello,
just a newbie in web development, also in ASP and PHP.
i just wanna ask how to send the data gathered from forms to emails?

Plz. help
Reply With Quote
  #2 (permalink)  
Old 06-26-2007, 08:11 AM
Senior Member
 
Join Date: Mar 2007
Posts: 193
Default

Quote:
Originally Posted by brinks View Post
hello,
just a newbie in web development, also in ASP and PHP.
i just wanna ask how to send the data gathered from forms to emails?

Plz. help


Here is a php script that will send any form information to an e-mail address

Code:
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message = stripslashes($message);
$to = "yourmail@yourdomain.com";
$subject = "Your Subject";
if (mail($to, $subject, $message))

{
   echo("<h1>Thank You</h1>");

}
Reply With Quote
  #3 (permalink)  
Old 06-26-2007, 08:14 AM
Senior Member
 
Join Date: Mar 2007
Posts: 274
Default

web host support different types of DLLs that are used for send email.
Reply With Quote
  #4 (permalink)  
Old 06-26-2007, 08:16 AM
Senior Member
 
Join Date: Apr 2007
Posts: 347
Default

Quote:
Originally Posted by Steve View Post
web host support different types of DLLs that are used for send email.
Yes steve

Windows NT - 2000 support CDONTS by default, Windows 2000 and 2003 support CDOSYS by default. Many providers support CDONTS on 2003 as well as other objects such as ASPEmail, Jmail and others.
Reply With Quote
  #5 (permalink)  
Old 06-26-2007, 08:20 AM
Senior Member
 
Join Date: May 2007
Posts: 329
Default

Quote:
Originally Posted by stevon View Post
Here is a php script that will send any form information to an e-mail address

Code:
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message = stripslashes($message);
$to = "yourmail@yourdomain.com";
$subject = "Your Subject";
if (mail($to, $subject, $message))

{
   echo("<h1>Thank You</h1>");

}

Thanks stevon but have another question...

How do we email multiple fields using PHP?
For example, in here mail($to, $subject, $message), you are only allowed one variable: $message. What if your form contains, say, 4 variables that need to be emailed.
Reply With Quote
  #6 (permalink)  
Old 06-26-2007, 08:22 AM
Senior Member
 
Join Date: Mar 2007
Posts: 193
Thumbs up

Quote:
Originally Posted by brinks View Post
Thanks stevon but have another question...

How do we email multiple fields using PHP?
For example, in here mail($to, $subject, $message), you are only allowed one variable: $message. What if your form contains, say, 4 variables that need to be emailed.

Try this code, I Hope it will help You.

Code:
$message = "The following data subimitted: \n
variable1: ".$var1."\n
"variable2: ".$var2."\n
"variable3: ".$var3."\n
"variable4: ".$var4."\n\n Thank You";

$to = "yourmail@yourdomain.com";
$subject = "Your Subject";
if (mail($to, $subject, $message))

{
echo("<h1>Thank You</h1>");

}
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:31 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0