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

  • Home
  • SEARCH
  • 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 8539693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:25:37+00:00 2026-06-11T11:25:37+00:00

i have a problem on my friends server when testing my php code on

  • 0

i have a problem on my friends server when testing my php code on it.(it works fine in my local server).

there is a form that contain checkbox inputs like

when submitting the form:

  1. In my server : print_r($_POST) prints:
    Array ( [names] => Array ( [0] => john [1] => sam ) )
  2. In his server : print_r($_POST) prints:
    Array ( [names] => Array )

and Array is a string not an array !

his php version is 5.2.17

<form method="post">
john <input type="checkbox" name="names[]" value="john"/>
sam <input type="checkbox" name="names[]" value="sam"/>
moh <input type="checkbox" name="names[]" value="moh"/>
<input type="submit"/>
</form>
<?php 
print_r($_POST);
?>
  • 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-11T11:25:38+00:00Added an answer on June 11, 2026 at 11:25 am

    From comments of first post here is the answer:

    You are doing this which is wrong: $_POST = array_map('stripslashes',$_POST);

    That’s exactly the cause of this problem, using stripslashes on every element of $_POST is worng, stripslashes works on strings and an array in string is equal to “Array” so that function is doing the convert of your array to "Array", you should write a custom function and check if the element is not an array use stripslashes or if it is use the array_map again, like this:

    <?php
    
    function stripslashes_custom($value){
        if(is_array($value)){
            return array_map('stripslashes_custom', $value);
        }else{
            return stripslashes($value);
        }
    }
    
    $_POST = array_map('stripslashes_custom', $_POST);
    
    ?>
    

    The reason of different results on array input for stripslashes function is probably due the different php versions …

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

Sidebar

Related Questions

I have the following problem in ASP.NET: there is a form that contains a
Hey friends I have one problem related to SQL Server 2008 R2. I set
The problem is that I have a PHP script (A) that does signup, authorize
Friends, I have a strange need and cannot think my way through the problem.
I have problem with show or hide form in Window Form Application. I start
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have a problem mapping a Json object recieved from the server into a
Hi friends hope all r doing well. I have a problem while reading xml
I have 2 classes: One that simulates a server and a second one. The
I have the following code to allow users to invite thier Facebook friends: function

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.