I am very new to Expression Engine. I am trying to create a form where users can post an entry into a channel. The entry consists of 11 fields. When I fill out the form I have created, all 11 fields get the entries I submit. However, there are two problems. First, after I click the submit button, I get an error message reading:
Fatal error: Unsupported operand types in /home/content/25/6865825/html/{../mongoinco/expressionengine/libraries/api/Api_channel_entries.php on line 1828Second, despite the message above, all of the field data entered still makes it to the fields, except the categories entry. The categories are basically location info. State and city. A state is the parent category with a city being the child. I am asking the user to select a city thereby also selecting the state. Below is my code. Am I missing a CP setting or not coding correctly? Thanks for the help.
{exp:safecracker channel="listings" return="thankyou" status="pending"}
<input type="hidden" name="entry_id" value="{entry_id}"/>
<input type="hidden" name="author_id" value="{author_id}"/>
<input type="hidden" name="url_title" value="{url_title}"/>
<input type="hidden" name="allow_comments" value="n"/>
<ul>
<li class="field_divider">
<label class="description" for="title">
<span class="required">* </span>Organization Name</label>
<div>
<input class="text_long" type="text" name="title" id="title" value="{title}"/>
</div>
</li>
{custom_fields}
{if field_name == "contact_name_first"}
<li class="field_divider">
<label class="description"><span class="required">* </span>Primary Contact Name</label>
<input class="name" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"/>{/if}
{if field_name == "contact_name_last"}
<input class="name" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"/>
<div>
<label id="small_text_first" for="contact_name_first">First Name</label>
<label id="small_text_last" for="contact_name_last">Last Name</label>
</div>
</li>
{/if}
{if field_name == "organization_email"}
<li class="field_divider">
<label class="description" for="organization_email"><span class="required">* </span>Contact E-mail</label>
<input class="text_long" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"/>
</li>
{/if}
{if field_name == "organization_website"}
<li class="field_divider">
<label class="description" for="organization_website">Website </label>
<div>
<input class="text_long" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="http://{field_data}" maxlength="{maxlength}"/>
</div>
</li>
<li class="field_divider">
<div id="opt_groups">
<div id="opt_group_wrap_state">
{category_menu} <label class="description" for="categories">City/Area</label> <select name="category[]" id="categories" size="4" multiple="multiple"> {select_options} </select> {/category_menu}
</div>
</div>
</li>
{/if}
{if field_name == "organization_address"}
<li class="field_divider">
<div>
<label class="description" for="organization_address">Address</label></div>
<input class="text_long" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}">
<div class="address_space">
<label class="small_text" id="street">Street</label>
</div>
</li>
{/if}
{if field_name == "organization_phone"}
<li class="field_divider">
<label class="description" for="organization_phone"><span class="required">* </span>Phone </label>
<div>
<label class="phone_number_text"> Example: (123) 456-7890</label>
</div>
<input class="text_long" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"/>
</li>
{/if}
{if field_name == "organization_zipcode"}
<li class="field_divider">
<label class="description" for="organization_zipcode"><span class="required">* </span>Zipcode </label>
<input class="text_medium" type="text" dir="{text_direction}" id="{field_id}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"/>
</li>
{/if}
{if field_name == "organization_services"}
<li class="field_divider">
<label class="description" for="organization_services"><span class="required">* </span>Services Offered </label>
<textarea class="textarea_large" id="{field_id}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea>
</li>
{/if}
{if safecracker_file} {display_field} {/if}
{/custom_fields}
<li class="buttons">
<input id="save_form" class="button">
</li>
</ul>
{/exp:safecracker}