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 7860387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:16:01+00:00 2026-06-02T22:16:01+00:00

Here’s the scenario: I have a contact form with few checkboxes: <input type=text name=cola[]

  • 0

Here’s the scenario: I have a contact form with few checkboxes:

<input type="text" name="cola[]" value="coke" />
<input type="text" name="cola[]" value="pepsi" />
<input type="text" name="cola[]" value="rc" />

Using jQuery’s serialize, I have the data string sent to my mailer.php like so:

$.ajax({
    type: "POST",
    url: "http://mydomain.com/mailer",
    data: dataString,
    success: function() {//some function}
});

Notice that I have had to omit the .php extension from the URL, due to a htaccess rewrite rule. If all 3 checkboxes are checked, the data string looks like: &cola=coke&cola=pepsi&cola=rc. I verified this using console.log.

mailer.php looks like this:

$cola = $_POST["cola"];
// other code
$message = "<p>" . $cola . "</p>";
// code to mail it out

However, upon successful mailing, the email body text just says “Array”, instead of “cola, pepsi, rc”.

I have a feeling it may be something to do with my rewrite conditions in my htaccess, which looks like this:

RewriteEngine On

# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]

My rewrite conditions are to remove any trailing / from the URL and wipe out the .php file extensions so that urls look like: domain.com/pretty

Can anybody help me diagnose why I’m getting the message “Array” instead of the array contents? Thank you!

  • 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-02T22:16:03+00:00Added an answer on June 2, 2026 at 10:16 pm

    It’s not your .htaccess the problem. In fact, $_POST[‘cola’] is an Array like this :

    Array 
    (
    [0] => 'cola'
    [1] => 'pepsi'
    [2] => 'rc'
    )
    

    You need to loop through the Array and get your informations.

    Hope this help.

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

Sidebar

Related Questions

Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input
Here is an example: I have the generic type called Account. I wish to
Here is a simple timepicker to jQuery UI's datepicker <script type=text/javascript> /* <![CDATA[ */
Here's a problem I ran into recently. I have attributes strings of the form
Here's my scenario - I have an SSIS job that depends on another prior
here is the scenario 1: user starts to type some word, autocomplete engine shows
Here's the basic setup: I have a thin bar at the top of a
Here is my problem : I have a post controller with the action create.
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here I have an int x=3; NSLog(@%i, x); How to have it displayed like

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.