Re: Register Globals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Got it:
mail($to, $_POST["subject"], wordwrap($_POST["message"], 60), "From: {$_POST["from"]}\r\n");
No more errors.
But nothing comes through from smtp. I checked to be sure with phpinfo. All values exist.
This worked though:
mail("jtjohnston@xxxxxxxxxxxxxxxxxx,taylorjo@xxxxxxxxxxxxxxxxxxxxxxx", "123", "456", "From: jtjohnston@xxxxxxxxxxxxxxx\r\n");
?

Larry E. Ullman wrote:

mail($to, stripslashes($_POST["subject"]), wordwrap($_POST ["message"], 60), "From: $_POST["from"]\r\n");

and I get:
Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www-html/emailer/index.html on line 41


The use of $var['index'] or $var["index"] ($_POST['from'], $_GET ["to"], etc.) within double quotation marks is causing the problem. To fix this, wrap the whole construct in curly braces:

mail($to, stripslashes($_POST["subject"]), wordwrap($_POST ["message"], 60), "From: {$_POST["from"]}\r\n");

You only have to do this within other quotation marks and only if the array's index is a string.

Hope that helps,
Larry


--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law."

 ' ' '    Collège de Sherbrooke:
ô¿ô    http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux