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 is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is a scenario: User installs .NET application that you have made. After some
Here is my scenario. I have a website running under AppPool1 and that works
Here is my problem.. I have the option to create(add) two new input fields,
Here the scenario is I have many .aspx pages if any page gives error,
Here's the scenario: I have a local git repository that mirrors the contents of
Here is the scenario: I have several CIFS partitions which AD-based users can mount
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is the scenario. I'm writing my geo-ruby oracle adapter for Ruby On Rails

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.