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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:09:41+00:00 2026-06-15T04:09:41+00:00

I hope someone is going to be able to help me on this one!

  • 0

I hope someone is going to be able to help me on this one!

I’m developing a web application in php and I want to submit an activity from one of my co-workers. Sometimes the activity is done by more than one co-worker so I’d like to be able to submit that activity, but in a way that all co-workers that were working on it get saved.

I decided to use drop-down-menus, so called the select tag in php. The html code is listed below:

<div id="placeholder">
<SELECT id="activeMember" NAME=name>
    <OPTION VALUE=0>Choose
    <OPTION VALUE=1>Mark
    <OPTION VALUE=2>James
    <OPTION VALUE=3>Emily
 </SELECT>

<button type="button" name="add" onclick="Add();">+</button>​

Below is the javascript code:

var _counter = 0;
function Add() {
    _counter++;
    var oClone = document.getElementById("activeMember").cloneNode(true);
    oClone.id += (_counter + "");
    document.getElementById("placeholder").appendChild(oClone);
}​

You can see how it works on this LINK

When the submit button is pressed, another script is called that saves the activity in my database:

$connection = mysql_connect("$host", "$username", "$password") or die("cannot connect");
mysql_select_db("$db_name") or die("cannot select DB");

$member = $_POST['name'];
$summary = $_POST['summary];
$date = date("l F d, Y");
$query = mysql_query("INSERT INTO activities (member, activitySummary, date) VALUES ( '" . $member . "', '" . $summary . "', $date."' )");

Now comes my problem. When I select Mark and James, if James is the second one selected, the activity is going to be saved only for him once I submit the form. Mark stays ignored. Also, if Mark, James and Emily are selected, the activity will get saved only for Emily. So, the form only saves the activity for the last selected co-worker.

Does anyone have any ideas how I can avoid that and successfully save a multiple number of co-workers/members for one activity?

  • 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-15T04:09:42+00:00Added an answer on June 15, 2026 at 4:09 am

    Rename your input to <SELECT id="activeMember" NAME="name[]">, then when the data gets submitted, it will be in an array.

    You’ll have to modify your PHP code to deal with the incoming array.

    $members = $_POST['name'];
    $summary = $_POST['summary'];
    $date = date('l F d, Y');
    
    foreach ($members as $member) {
        if (empty($member)) {
            continue;
        }
    
        $query = mysql_query("INSERT INTO `activities` (`member`, `activitySummary`, `date`) VALUES ( '{$member}', '{$summary}', '{$date}' )");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really weird authentication problem going on - hope someone can help! The Domino Web
Hope someone could help me with this: I would like to have a column
Hope someone can help i cant seem to get my head around this, i
Hope someone can help me out with this problem I am having. I just
I hope someone can help me here. I'm having trouble loading this variable. Right
I hope someone can help me with this, as I'm unable to find the
I hope someone can help me out with this. I can't reproduce this error
This is driving me nuts so I hope someone can help an Objective-C noob
I hope someone can help. My asp.net application is exhibiting strange behaviour. Whenever I
This really makes my view ugly. I hope someone has the solution. My activity

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.