Welcome Guest, Not a member yet? Register   Sign In
Select Multiple Field - Array Problem.
#1

[eluser]Unknown[/eluser]
Greetings Everyone,

I am a newbie to Codeigniter and I am not use to the way php is coded using this application so I get lost easy. My question today is that I have a contact form that requires a multiple selection field and when I send the form I get an email stating that "Enhancements = Array" as the value instead of getting the actual values that are in the field code.

Here is the code:

Code:
$this->load->library('validation');
        
        $fields = array(            
            'name'             => 'Name',
            'organization'     => 'Buiness Name/Organization',
            'address'         => 'Address',
            'city'             => 'City',
            'state'                 => 'State',
            'zip'             => 'Zip',
            'email'                 => 'Email',
            'phone'                 => 'Phone',
            'website'         => 'Website',
            'contactby'             => 'Contact By',
            'hosting'         => 'Hosting',
            'flash'                 => 'Flash',
            'domain'         => 'Domain',
            'num_pages'             => 'Number of Pages',            
            'enhancements[]'     => 'Enhancements',        
            'budget'                 => 'Budget',        
            'sitetype'         => 'Sitetype',        
            'reason'                 => 'Reason for Quote',
            'hear'             => 'How did you hear about us?',            
            'comments'         => 'Comments'
        );
        
        $rules = array(                    
            'name'             => 'trim|required',
            'organization'     => 'trim',
            'address'         => 'trim',
            'city'             => 'trim',
            'state'                 => 'trim',
            'zip'             => 'trim',
            'email'                 => 'trim|required|valid_email',
            'phone'                 => 'trim',
            'website'         => 'trim',
            'contactby'             => 'trim',
            'hosting'         => 'trim',
            'flash'                 => 'trim',
            'domain'         => 'trim',
            'sitetype'         => 'trim',    
            'num_pages'             => 'trim',            
            'budget'                       => 'trim',        
            'reason'                 => 'trim',
            'hear'             => 'trim',            
            'comments'         => 'trim|'
        );
            
        $this->validation->set_rules('enhancements[]', 'Enhancements', 'trim|required');    
        $this->validation->set_rules($rules);        
        $this->validation->set_fields($fields);        
        $this->validation->set_error_delimiters('<div class="error">', '</div>');


HTML PART

<fieldset><legend>Enhancements / Additional Features</legend><p>
       <label>Enhancements</label>
    <select name="enhancements[]" size="10" multiple="multiple" id="enhancements"  value="&lt;?= $this->validation->enhancements;?&gt;" />>
                            <option value="">None Selected</option>
                         <option value="Blog">Blog</option>
                         <option value="Captcha">Captcha forms (reduces spam)</option>
                         <option value="CMS">Content Management System</option>
                         <option value="Forum">Forum</option>
                         <option value="Google Analytics">Google Analytics</option>
                         <option value="Google Map">Google Map</option>
                         <option value="HTML Newsletters">HTML Newsletters</option>
                         <option value="Chat">Live Chat</option>
                         <option value="Maintenance">Monthly Maintenance Plans</option>
                         <option value="Marketing">Online Marketing</option>
                         <option value="Pay per Click">Pay Per Click</option>
                         <option value="Photo Gallery">Photo Gallery</option>
                         <option value="SEO">Search Engine Optimization</option>
                         <option value=

Can anyone tell me what I am doing wrong for the values of Enhancements not to show up in the email when sent?

Thanks a bunch!!!
#2

[eluser]Unknown[/eluser]
Here is another piece of the code I forgot...
Code:
//Let there be Email
            $message = array(
                'name'             => $this->input->post('name'),
                'organization'     => $this->input->post('organization'),
                'address'         => $this->input->post('address'),
                'city'             => $this->input->post('city'),
                'state'         => $this->input->post('state'),
                'zip'             => $this->input->post('zip'),
                'email'         => $this->input->post('email'),
                'phone'         => $this->input->post('phone'),
                'website'         => $this->input->post('website'),
                'contactby'     => $this->input->post('contactby'),
                'hosting'         => $this->input->post('hosting'),
                'flash'         => $this->input->post('flash'),
                'domain'         => $this->input->post('domain'),
                'num_pages'     => $this->input->post('num_pages'),    
                'budget'         => $this->input->post('budget'),
                'enhancements'    => $this->input->post('enhancements'),    
                'sitetype'         => $this->input->post('sitetype'),    
                'reason'         => $this->input->post('reason'),
                'hear'             => $this->input->post('hear'),        
                'comments'         => $this->input->post('comments')
            );




Theme © iAndrew 2016 - Forum software by © MyBB