I am using safecracker to create a form for advertisers to place adverts on my site.
I want to ask them if they would like to include their telephone number and email address on their advert so have included the following checkbox custom field:
contact_preferences
This field has the following 2 multi-select options
Display my email address
Display my telephone number
I display this checkbox as follows:
{custom_fields}
{if checkbox}
{options}
<label class="checkbox"><input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked} /> {option_value} </label>
{/options}
{/if}
{/custom_fields}When I submit my form, I can see via the control panel that it works.
My question is how would I include an if statement in my code to display the advert based on the value of this custom field?
Here is some psuedo code to try and show what I need
{exp:channel:entries channel="adverts" show_empty="yes" limit="1"}
if {contact_preferences["Display my email address"] == true}
{contact_email}
end if
if {contact_preferences["Display my telephone number"] == true}
{contact_telephone}
end ifI see if I just display
{contact_preferences}within the channel entries tag, I get the following if I had checked both checkboxes:
Display my email address, Display my telephone number
Thanks in advance for any help
Paul