By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,304 Members | 3,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,304 IT Pros & Developers. It's quick & easy.

trying to use php and sendmail to generate e-mails from form data

P: 5
Hi all,

I know that this should be an easy thing, but I haven't figured out how to get this to work on my server at home. I have a roommate who is using PHPBB on his site on the server and that is able to send out e-mails no problem. I have created a simple form that sends data to a php page that then gets the data and then should send it out using the send() function. What is going on in actuality is that upon submitting the html form, the browser just sits there indefinately, it doesn't pass an error message or time out or anything.

I am running Linspire 5.0 with Apache 1.3 and PHP 4.3.10.

I know nothing about sendmail, although the mail() function looks easy enough. I haven't found the php error_log yet. I ran a phpinfo() to try to find it's location, and it just says 'error_log: no value'. Can anyone tell me where I should start? Here is the code for my simple form and php page:

[php]
<html>
<body>
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" /><br>
Message:
<textarea name="message" rows="10" cols="30"></textarea>
<input type="submit" />
</form>
</body>
</html>
[/php]

[php]
<html>
<body>
<?
$email = $_GET['email'] ;
$message = $_GET['message'] ;
mail( "wendall_dogman@yahoo.com", "Email Subject", $message, "From: $email" );
print "Congratulations your email has been sent";
?>
</body>
</html>
[/php]
Sep 28 '06 #1
Share this Question
Share on Google+
2 Replies


ronverdonk
Expert 2.5K+
P: 4,258
In your first script tou define the form with action=post.
In your receiving form you use the $_GET array to get the values. Of course your variables do not have a value. You should fill your variables from the $_POST array..

Ronald :cool:
Sep 28 '06 #2

P: 5
In your first script tou define the form with action=post.
In your receiving form you use the $_GET array to get the values. Of course your variables do not have a value. You should fill your variables from the $_POST array..

Ronald :cool:
wow, that's a no-brainer. I have changed the $_GET array references to $_POST. Still the same result, though, the page just hangs. Any other ideas? Thanks again.
Sep 28 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.