Reputation: 25
<?php
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$reason = $_POST['dropdown'] ;
$message = $_POST['message'] ;
mail("[email protected]", "CWSDesigns Form", "You have received a new message.
Name: " . $name . "
From: " . $email . "
Purchasing: " . $reason . "
Message: ". $message .");
?>
I get the error message
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /home/u161219738/public_html/contact.php on line 13
I don't know any PHP. I know there errors probably something basic and there are probably other errors in the script.
Upvotes: 0
Views: 53
Reputation: 1264
You can place variables within a double quoted block, without worry. Your code had the closing quotes in the wrong place, and your modified code did as well, try this.
<?php
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$reason = $_POST['dropdown'] ;
$message = $_POST['message'] ;
mail("[email protected]", "CWSDesigns Form", "You have received a new message.
Name: $name
From: $email
Purchasing: $reason
Message: $message");
?>
Upvotes: 0
Reputation: 5856
The last " is not closed/terminated. You may want to use a editor with proper syntax highlighting to avoid this kind of mistakes! Also be aware to escape/sanatize any possible malicious input from a user.
Upvotes: 1