PHP Code:
$body = <<<END
Name: $_POST['name']\n;
Email: $_POST['email']\n;
Phone: $_POST['phone']\n;
END;
unfortunately, that gets you this:
Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING [...]
Complex variables (read: indexes) still mess things up. Bluewalrus' {brackets suggestion} actually fixes it:
PHP Code:
$body = <<<END
Name: {$_POST['name']}\n;
Email: {$_POST['email']}\n;
Phone: {$_POST['phone']}\n;
END;
As a side note - and your ending sequence was correct, kauu, but I can see this being overlooked - you will also get a parse error if your END; is not followed immediately by a line break. So, this is correct:
PHP Code:
END;
// there's another line right here
but this is not:
PHP Code:
END; //this is the last line in the script (also, there's whitespace and a comment after the END; )
Bookmarks