Reply to Re: [PHP] Register Globals

Your name:

Reply:


Posted by "Larry E. Ullman" on 11/05/05 04:24

> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация