Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Dear all, I have a problem sending this form as an email. The error message I got is "Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\htdocs\phpdw\contact.php on line 14". I did a search on "sendmail_from" in php.ini and found that I had set "sendmail_from = tmng2005@yahoo.com". Do I have to do anything further with php.ini ? As far as the code in line 14 is concerned, it is "mail($to, $subject, $message);". Any ideas or suggestions? Below is the code of this form.
Many thanks ahead!
TommyCode: Select all
<?php
if (array_key_exists('ewComments', $_POST)) {
// mail processing script
// initialize variables
$to = 'tmng2005@yahoo.com';
$subject = 'Feedback from East-West Seasons';
// build the message
$message = 'From: '.$_POST['name']."\n\n";
$message .= 'Email: '.$_POST['email']."\n\n";
$message .= 'Comments: '.$_POST['message'];
// send the email
mail($to, $subject, $message);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>East-West Seasons</title>
<?php include('style_rules_monthly.php'); ?>
</head>
<body>
<div id="wrapper">
<div id="titlebar"><img src="images_common/<?php echo $theme; ?>_top.jpg" alt="East-West Seasons" width="738" height="122" /></div>
<div id="maincontent">
<div id="nav">
<ul>
<li><a href="index.php">Home[/url]</li>
<li><a href="news.php">News[/url]</li>
<li><a href="blog.php">Blog[/url]</li>
<li><a href="gallery.php">Gallery[/url]</li>
<li><a href="contact.php">Contact[/url]</li>
</ul>
</div>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="contactForm" id="contactForm">
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
</p>
<p>
<label for="message">Message:</label>
<textarea name="message" cols="60" rows="6" id="message"></textarea>
</p>
<p>
<input name="ewComments" type="submit" id="ewComments" value="Send comments" />
</p>
</form>
</div>
</div>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]