fellow warriors of the cathode tube,
I am kinda new to php and I am trying to use the send mail function to send mail. I am using data posted to the function from a form on the previous page. Now when I click send, I get the following errors
Notice: Undefined variable: subject in e:\inetpub\wwwroot\php\feedback.php on line 3
Notice: Undefined variable: message in e:\inetpub\wwwroot\php\feedback.php on line 3
I get the mail fine, but it has no subject and no body.....ok, so I guess I don't get it fine.
Is there something I am missing in my php.ini?
//feedback.html
<html><title>Email the Webmaster</title>
<form name="form" method="post" action="feedback.php">
<p>To: <input type="text" name="subject"></p>
<p>Message: <textarea name="message"></textarea></p>
<input type="submit" name="Submit" value="Submit">
</form></html>
//feedback.php
<html><title>Email Sent to Webmaster</title>
<?php
mail("emailaddy", $subject, $message) ;
?></html>
mail()
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
try this, if this doesnt work its something wrong with your config
this also supports HTML based e-mails
Code: Select all
$email = "youremail@me.com";
$subject = "TEST TEST TEST";
$message = "<body>Testing Mail Functionality</body>";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
// mail me
mail("$email", "$subject", "$message", "$headers");-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Do you have register_globals on or off in php.ini? I would guess off which means you need
Code: Select all
<html><title>Email Sent to Webmaster</title>
<?php
mail("emailaddy", $_POST['subject'], $_POST['message']) ;
?></html>-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
i should point out that the reason i do that is because i use this sort of thing in all my scripts
just thought i'd point this out to avoid confusion
Code: Select all
$email = $_POST['email'];
$subject = $_POST['subject'];