I’m putting together a contact form with FreeForm and I have a subject field as a select input that lists various services the company provides.
I want to make this list of services editable through ExpressionEngine so I’ve created a Global Variable ({contact-subjects}) with this inside it:
Piano Restoration (.(JavaScript must be enabled to view this email address)),
Piano Removal (.(JavaScript must be enabled to view this email address)),
Piano Tuning (.(JavaScript must be enabled to view this email address)),
Piano Hire (.(JavaScript must be enabled to view this email address))
The idea being that I’ll parse this variable with PHP and construct the select input and use the email address in the curly brackets as the recipients for FreeForm.
The problem is for some reason I cannot explode the string…
I’ve started with this:
$contact_subjects = "{contact-subjects}";
$parsed_subjects = explode(",", $contact_subjects);
echo '<pre>';
print_r($parsed_subjects);
echo '</pre><p>‘;And I get this:
Array
(
[0] => Piano Restoration (.(JavaScript must be enabled to view this email address)),
Piano Removal (.(JavaScript must be enabled to view this email address)),
Piano Tuning (.(JavaScript must be enabled to view this email address)),
Piano Hire (.(JavaScript must be enabled to view this email address))
)It hasn’t parsed the string…
If I do this:
$contact_subjects = "Piano Restoration (.(JavaScript must be enabled to view this email address)),
Piano Removal (.(JavaScript must be enabled to view this email address)),
Piano Tuning (.(JavaScript must be enabled to view this email address)),
Piano Hire (.(JavaScript must be enabled to view this email address))";
$parsed_subjects = explode(",", $contact_subjects);
echo '<pre>';
print_r($parsed_subjects);
echo '</pre><p>‘;I get what I would expect:
Array
(
[0] => Piano Restoration (.(JavaScript must be enabled to view this email address))
[1] =>
Piano Removal (.(JavaScript must be enabled to view this email address))
[2] =>
Piano Tuning (.(JavaScript must be enabled to view this email address))
[3] =>
Piano Hire (.(JavaScript must be enabled to view this email address))
)Has anyone else had this kind of problem?