...

View Full Version : PHP Error in mail()



UltimateCoder
01-31-2012, 02:02 PM
I have this to enable somone to send a message to someone.


<?php


$from=$_POST['email_from'];
$to=$_POST['email_to'];
$subject=$_POST['subject'];
$message=$_POST['message'];

mail($to,$subject,$message,$from);
?>


The error message my site is giving me is


Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/a5461089/public_html/action.php on line 6



any help

myfayt
01-31-2012, 02:05 PM
You forgot a single quote.


$to=$_POST['email_to];

Change to this


$to=$_POST['email_to'];

abduraooft
01-31-2012, 02:34 PM
You'd have found it yourself if you had used the
][/COLOR] tags to wrap your code, like

<?php


$from=$_POST['email_from'];
$to=$_POST['email_to];
$subject=$_POST['subject'];
$message=$_POST['message'];

mail($to,$subject,$message,$from);
?>

tangoforce
01-31-2012, 06:36 PM
You'd have found it yourself if you had used the
][/COLOR] tags to wrap your code, like

<?php


$from=$_POST['email_from'];
$to=$_POST['email_to];
$subject=$_POST['subject'];
$message=$_POST['message'];

mail($to,$subject,$message,$from);
?>

Well said. How ironic is it that 'UltimateCoder' can't see these things? :eek:

@'UltimateCoder': You should also be using mail() inside an if() conditional to test that it is accepted by sendmail.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum