Jump to content

Unexpected T_ENCAPSED_AND_WHITESPACE


membot

Recommended Posts

I haven't used PHP in a while. I'm getting "unexpected T_ENCAPSED_AND_WHITESPACE" on the second line of this:

 

if(isset($_GET['name'], $_GET['organization'], $_GET['email'], $_GET['message'])){
mail('[email protected]', 'maybearobot: '.$_GET['organization'], "Name: $_GET['name'] /n/n Return Email: $_GET['email'] /n/n $_GET['message']");
}

Link to comment
https://forums.phpfreaks.com/topic/249274-unexpected-t_encapsed_and_whitespace/
Share on other sites

When you use an array with single quotes around the key name in an interpolated string you have to put a block around the variable:

 

mail('[email protected]', 'maybearobot: '.$_GET['organization'], "Name: {$_GET['name']} /n/n Return Email: {$_GET['email']} /n/n {$_GET['message']}");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.