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: $valuenn";} 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>");
}
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.Code:
Code:
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $valuenn";} 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.
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."nn Thank You";
$to = "yourmail@yourdomain.com";
$subject = "Your Subject";
if (mail($to, $subject, $message))
{
echo("<h1>Thank You</h1>");
}
