Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
escaping parentheses?
I will be trying to use the following code with zem_contact_reborn and wondered if I’ve got my php correct?
Can anyone let me know if I need to escape my parentheses?
<code>
<txp:php>
global $zem_contact_form;
switch($zem_contact_form[‘Deliver To’]) {
case ‘AnnMarie Schultz (Admin)’: echo ‘blah@gmail.com’; break;
case ‘Geoff Bradford (Lead Pastor)’: echo ‘blah@gmail.com’; break;
case ‘Joe’: echo ‘blah@gmail.com’; break;
default: echo ‘blahandpoop@gmail.com’;
}
</txp:php>
</code>
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: escaping parentheses?
You shouldn’t need to escape those parentheses. Looks….kinda right to me…..I don’t know where $zem_contact_form['Deliver To']
is coming from, but it looks right.
Offline
Re: escaping parentheses?
zem_contact_form is a global variable that comes from the zem_contact_reborn plugin. Only if you wanted to use single quotes in that string they’d have to be escaped (by adding a backslash in front of it). Anything else is okay.
Offline
Re: escaping parentheses?
Only if you wanted to use single quotes in that string they’d have to be escaped (by adding a backslash in front of it). Anything else is okay.
I think ruud is saying that your code is okay right now, but that if you wanted to use single quotes in any of the strings you’d have to escape it, which agree with my analyzation.
I knew where zem_contact_form was coming from on the global, but now I realise I know where the [‘Deliver To’] array var is coming from. It was a property you set in the txp:zem_contact_reborn tag, wasn’t it?
Offline
Re: escaping parentheses?
^^ exactly, that’s what I meant.
The ‘Deliver To’ is probably the label attribute of a zem_contact_select tag, so visitors can select who they want to send the email to when using the zem_contact_reborn form.
Offline
Pages: 1