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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:39:35+00:00 2026-06-11T12:39:35+00:00

I have this two arrays, which come both from some checkbox selections and they

  • 0

I have this two arrays, which come both from some checkbox selections and they are:

$date=$_REQUEST['date'];
$pdv=$_REQUEST['checkbox'];

The first array lists some dates, what i need is to loop therough the dates, and insert pdv values selected for that date in the database, something like:

[date] [1] => [pdv] [1]
           => [pdv] [2]
           => [pdv] [3]

[date] [2] => [pdv] [1]
           => [pdv] [2]

Then i will have this loop which will permit me to insert in the database valus :

   [date] [1] - [pdv] [1] ; [date] [1] - [pdv] [2];

I thought of using this foreach but i am not that professional with php.. here’s where i’m asking for your help..

foreach($date as $val) {
foreach ($checkbox as $pdv) {
$values_arr[] = "('" . $val . "','" . $pdv . "')";
}
$values = implode(", ", $values_arr);

$sql="INSERT INTO date (att_id,date) VALUES $values";
mysql_query($sql)or die(mysql_error());
}
  • 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-11T12:39:36+00:00Added an answer on June 11, 2026 at 12:39 pm

    There are many useful functions here, try some of them:

    http://php.net/manual/en/ref.array.php

    Like this one:

    http://php.net/manual/en/function.array-combine.php

    And use print_r for view result array:

    <pre>
        <?php print_r($array) ?>
    </pre>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two arrays with time values in them in this format. 00:00:00 which
I have two arrays which I'm trying to merge based on the date of
i have two arrays like this first array Array ( [0228] => Array (
I have two arrays the first one has this structure Parameter Keys array array
I have two arrays that I create like this: public int GameBoard[][] = new
I have this two tables from my program to manage stock: Articulos (items): id_articulo
I have two arrays containing different keys and values. However, some keys store strings
I have two arrays. The first one contains an id, username, and password from
I have to array and I want to merge this two array with a
I have a two-dimensional array. When I print/dump this I get the following My

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.