Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:07:32+00:00 2026-06-07T04:07:32+00:00

In my controller i am setting rules like this $this->form_validation->set_rules(contact_name[],Contact Name,required|max_length[25]|xss_clean|htmlspecialchars); $this->form_validation->set_rules(contact_title[],Contact Title,required|max_length[25]|xss_clean|htmlspecialchars); $this->form_validation->set_rules(contact_main[],Contact

  • 0

In my controller i am setting rules like this

$this->form_validation->set_rules("contact_name[]","Contact Name","required|max_length[25]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_title[]","Contact Title","required|max_length[25]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_main[]","Contact Main Number","required|max_length[45]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_direct[]","Contact Direct Number","required|max_length[45]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_cell[]","Contact Cell Number","required|max_length[45]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_primary","Primary","required|max_length[45]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_fax[]","Fax","required|max_length[105]|xss_clean|htmlspecialchars");
        $this->form_validation->set_rules("contact_email[]","Contact Email ID","required|max_length[105]|xss_clean|htmlspecialchars");

and the html is = >

 <input type="text" name="contact_name[]" value="Dileep" class="t_contact_name">
     //and some others too as name as array

after posting i will get something like this

array
  'company' => string 'Sccc' (length=4)
  'name' => string 'Ajay ccc' (length=8)
  'address' => string 'ccsd' (length=4)
  'city' => string 'City name' (length=9)
  'state' => string '20' (length=2)
  'zip' => string '665996555' (length=9)
  'country' => string '6' (length=1)
  'category' => string 'popular' (length=7)
  'credit' => string '2566' (length=4)
  'website' => string 'ccc' (length=3)
  'primary_flag' => string '1' (length=1)
  'discount' => string '0' (length=1)
  'payment_terms' => string '6' (length=1)
  'customerid' => string 'ccc' (length=3)
  'notes' => string 'cc' (length=2)
  'contact_name' => 
    array
      0 => string 'Dileep' (length=6)
      1 => string 'Dileep' (length=6)
      2 => string 'Dileep' (length=6)
      3 => string 'Dileep' (length=6)
      4 => string 'Dileep' (length=6)
      5 => string 'Dileep' (length=6)
      6 => string 'Dileep' (length=6)
      7 => string 'Dileep' (length=6)
      8 => string 'Dileep' (length=6)
  'contact_primary' => 
    array
      0 => string 'true' (length=4)
      1 => string 'false' (length=5)
      2 => string 'false' (length=5)
      3 => string 'false' (length=5)
      4 => string 'false' (length=5)
      5 => string 'false' (length=5)
      6 => string 'false' (length=5)
      7 => string 'false' (length=5)
      8 => string 'false' (length=5)
  'contact_title' => 
    array
      0 => string 'Curio' (length=5)
      1 => string 'Curio' (length=5)
      2 => string 'Curio' (length=5)
      3 => string 'Curio' (length=5)
      4 => string 'Curio' (length=5)
      5 => string 'Curio' (length=5)
      6 => string 'Curio' (length=5)
      7 => string 'Curio' (length=5)
      8 => string 'Curio' (length=5)
  'contact_main' => 
    array
      0 => string '66558-66554-6665' (length=16)
      1 => string '66558-66554-6665' (length=16)
      2 => string '66558-66554-6665' (length=16)
      3 => string '66558-66554-6665' (length=16)
      4 => string '66558-66554-6665' (length=16)
      5 => string '66558-66554-6665' (length=16)
      6 => string '66558-66554-6665' (length=16)
      7 => string '66558-66554-6665' (length=16)
      8 => string '66558-66554-6665' (length=16)
  'contact_direct' => 
    array
      0 => string '5555-666-555' (length=12)
      1 => string '5555-666-555' (length=12)
      2 => string '5555-666-555' (length=12)
      3 => string '5555-666-555' (length=12)
      4 => string '5555-666-555' (length=12)
      5 => string '5555-666-555' (length=12)
      6 => string '5555-666-555' (length=12)
      7 => string '5555-666-555' (length=12)
      8 => string '5555-666-555' (length=12)
  'contact_cell' => 
    array
      0 => string '555-6654-555' (length=12)
      1 => string '555-6654-555' (length=12)
      2 => string '555-6654-555' (length=12)
      3 => string '555-6654-555' (length=12)
      4 => string '555-6654-555' (length=12)
      5 => string '555-6654-555' (length=12)
      6 => string '555-6654-555' (length=12)
      7 => string '555-6654-555' (length=12)
      8 => string '555-6654-555' (length=12)
  'contact_fax' => 
    array
      0 => string '996-5565-656' (length=12)
      1 => string '996-5565-656' (length=12)
      2 => string '996-5565-656' (length=12)
      3 => string '996-5565-656' (length=12)
      4 => string '996-5565-656' (length=12)
      5 => string '996-5565-656' (length=12)
      6 => string '996-5565-656' (length=12)
      7 => string '996-5565-656' (length=12)
      8 => string '996-5565-656' (length=12)
  'contact_email' => 
    array
      0 => string 'mailer@mail.com' (length=20)
      1 => string 'mailer@mail.com' (length=20)
      2 => string 'mailer@mail.com' (length=20)
      3 => string 'mailer@mail.com' (length=20)
      4 => string 'mailer@mail.com' (length=20)
      5 => string 'mailer@mail.com' (length=20)
      6 => string 'mailer@mail.com' (length=20)
      7 => string 'mailer@mail.com' (length=20)
      8 => string 'mailer@mail.com' (length=20)
  'userfile2' => string '' (length=0)
  'contact_log' => 
    array
      0 => string 'Waiting for the release....' (length=27)
  'contact_time' => 
    array
      0 => string '6/30/12' (length=7)
  'contact_duedate' => 
    array
      0 => string '12/01/2012' (length=10)

But when i do run the form validation i am getting some errors

A PHP Error was encountered

Severity: Warning

Message: mb_strlen() expects parameter 1 to be string, array given

Filename: libraries/Form_validation.php

Line Number: 1003
A PHP Error was encountered

Severity: Warning

Message: htmlspecialchars() expects parameter 1 to be string, array given

Filename: libraries/Form_validation.php

Line Number: 619

What is the real problem or what am I doing wrong?

Edit

Please check that the input names are array,there are more than same type values.So i need to use field names as array.

as per the codeigniter Form validation i can validate the form with containng field names as array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:07:34+00:00Added an answer on June 7, 2026 at 4:07 am

    Your input is consisted of arrays, while the functions max_length and htmlspecialchars expect a single string.

    When there is only one value use this type of input:

    <input type="text" name="contact_name" value="Dileep" class="t_contact_name">
    

    On inputs where array is a must don’t use the aforementioned functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is sort of a duplicate of Trouble setting a default controller in MVC
The controller function: function signup() { $bool1 = $this->form_validation->run('username'); $bool2 = $this->form_validation->run('email'); $bool3 =
Other then setting UIGestureRecognizers in a Controller: UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:v action:@selector(handleSwipe:)];
Using a navigation controller, I am pushing a new view and setting the title
I'm calling an NSObject from a UIViewController, and I'm setting the view controller as
Controller First I tried this: [HttpPost] public ActionResult Edit(JournalEntry journalentry) { if (ModelState.IsValid) {
In my controller I am setting my value to true: ViewData[itemName] = true; Then
I'm trying to set some htaccess rules for a specific Kohana controller. Basically its
Are there any differences in performance by setting the Root View Controller in IB
Previously I registered dependencies in IoC container at application start setting controller factory. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.