NachoRuba NachoRuba - 5 months ago 24
PHP Question

Insert a Variable inside simple quotation marks PHP

How i can use a variable ($_REQUEST('subject')) inside simple quotation marks.
This is my code:

<?php
$uri = 'https://mandrillapp.com/api/1.0/messages/send.json';

$postString = '{//i can't quit this quotation mark
"key": "myapi",
"message": {
"html": "this is the emails html content",
"subject": "$_REQUEST['subject'];",//this dont work
"from_email": "email@mydomain.com",
"from_name": "John",
"to": [
{
"email": "test@hotmail.com",
"name": "Bob"
}
],
"headers": {
},
"auto_text": true
},
"async": false
}';
?>

ldg ldg
Answer

change "subject": "$_REQUEST['subject'];" to "subject": "' . $_REQUEST['subject'] . '"