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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:29:00+00:00 2026-06-03T08:29:00+00:00

$serialize_me = array( array( ‘Name’ => ‘English’, ‘Apprev’ => ‘en’, ‘default’ => true, ),

  • 0
$serialize_me = array(
    array(
      'Name' => 'English',
      'Apprev' => 'en',
      'default' => true,
    ),
    array(
      'Name' => 'عربي',
      'Apprev' => 'ar',
      'default' => false,
    ),
); 
$serialized = serialize($serialize_me); 

Using this array, I’m able to serialize the data and insert it into a database. But how can I build such an array using a form?
I’m trying to build a form that will allow me to serialize the data and insert it into a database.

  • 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-03T08:29:01+00:00Added an answer on June 3, 2026 at 8:29 am

    on the HTML side (called for example whatever.php):

    <form action="action.php" method="post">
    <?php
      $num_languages = 2; // Set this to the number of languages you want.
      for($x = 0; $x < $num_languages; $x++) {
    ?>
    <input type="text" name="name[<?php echo $x; ?>]" />
    <input type="text" name="apprev[<?php echo $x; ?>]" />
    <input type="checkbox" name="default[<?php echo $x; ?>]" />
    <?php } ?>
    </form>
    

    and then on the PHP side (in the case of this example a file called action.php):

    <?php
      $array_serialize = array();
      foreach ($_POST['name'] as $key => $value) {
        $array_serialize[$key]['Name'] = $value;
        $array_serialize[$key]['Apprev'] = $_POST['apprev'][$key];
        $array_serialize[$key]['default'] = ($_POST['default'][$key] == 'on')?true:false;
      }
      $serialized = serialize($array_serialize); 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a the .replace() method in javascript to convert a serialized array of
how can insert data array <input name='hello[]'> with function serialize in database? please give
I'm using this jquery to serialize my form and pass it to a PHP
I'm facing an odd problem.... $string is user input $log = serialize(array('string' => $string);
I need to serialize an object using the BinaryFormatter with .NET 4.0 and send
I have this form: http://jsfiddle.net/michelejs/Pt6LQ/ The problem is that I am not be able
I have this array structure Array ( [xyz] => Array ( [1] => 3
I need to serialize array which contains URLs: Array( 'url1' => 'http://www.example.com', 'url2' =>
I got an array like this $value = {array('id'=>$id, 'email'=>$email, 'token'=>$token)} I want to
I have a List that, when serialized as JSON gives me an array of

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.