Custom form publishing & ldquo; Array & rdquo; rather than the input values ​​of the user


We are using the Aheadworks Helpdesk Module and are trying to create a second form to capture specific information and use the form to create a ticket where all of the form content gets posted to the "content" section of Helpdesk.

The problem is, if I use the name="content", what gets posted into the "content" section is simply "Array"

The form code is quite simple:

<form id="helpdesk-ticket-form" action="../helpdeskultimate/customer/new/" method="post" enctype="multipart/form-data"><input name="title" value="WHOLESALE SETUP REQUEST" type="hidden">
<div><label for="title_field">Name<span class="required">*</span></label><br> <input id="title" class="input-text required-entry" style="width: 250px;" name="" value="" type="text"></div>
<div><label for="title_field">Company Name<span class="required">*</span></label>    <br><input id="content_field" class="input-text " title="Company" name="content" value="" type="text"></div>
<input name="department_id" value="2" type="hidden">
<div><label for="content_field">Message<span class="required">*</span></label><br>     <textarea id="content_field" class="required-entry" style="width: 450px;" name="content" rows="10" cols="53"></textarea></div>
<div><label for="filename">Attach Reseller Permit (2Mb limit)</label><br> <input id="filename" class="input-file" style="width: 450px;" name="filename" type="file"></div>
<div class="button-set">&nbsp;</div>
<div class="button-set"><span><span><br></span></span></div>
<div class="button-set"><button class="button right form-button" type="submit"><span>  <span>Submit ticket</span></span> </button></div>

I have tried using name="content[]" but it also returned "Array"

The module looks to be using this post method:

public function newAction()
    if (!$this->_getCustomerSession()->getCustomerId()) {
    $session = Mage::getSingleton('core/session');
    $customer = $this->_getCustomerSession()->getCustomer();

    $Proto = Mage::getModel('helpdeskultimate/proto');
    $postData = $this->getRequest()->getPost();

    if (isset($postData['department_id'])) {
    try {


The insert into the message field seems to come from here:

/* Insert */
    try {
        $validateResult = $message->validate();

The full controller file can be downloaded from

I am not sure how to actually use a foreach statement with the @$postData['content'], or if there is a better solution.

I would happily ask AheadWorks, but have been told by them that they are not accepting customization inquiries at this time (too busy)...

Any help would be greatly appreciated!

The word "Array" is what you get when you convert a PHP array into a string; since array values can contain anything, PHP doesn't bother trying to figure out how to convert an array and just returns the string "Array". This is exactly what happens in the line:

// The trim() function casts $data as a string => string(5) "Array"

There are functions that do return a string representation of array contents, such as print_r(). This will spit out the array in a multiline string, so incorporating that in your code would be:

$message->setContent(print_r($data['content'], TRUE));

If you wanted the contents of the array as a single-line string you should probably use a foreach() statement like you mentioned in your question. Here's a quick example:

$contentString = 'Second Form values:' . PHP_EOL;
foreach($data['content'] as $key => $value) {
    $contentString .= PHP_EOL . '    ' . $key . ': ' . $value;

Then you would be able to use $contentString as the message instead of accessing the $data array value directly. I don't know what the validate() method is doing in your example, but it is definitely a good idea to ensure that you are properly escaping the values within this second form before you use them as the body of an email.