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

The Archive Base Latest Questions

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

I have a form that dynamically prints out names based on a unique name

  • 0

I have a form that dynamically prints out names based on a unique name tag.
To be used for responding on invitations. There can be multiple users for each name tag, i.e. couples, couples with children, etc.
For each name there is a radio-button where the invitee can select whether he/she is coming to the party or not (has the value 1=not coming, 2=coming). It can look like this, for a couple:

Lady Mary S
I am not coming         - radio - value 1
I am coming             - radio - value 2

Mister Hans S
I am not coming         - radio - value 1
I am coming             - radio - value 2

Child of Mary & Hans S
I am not coming         - radio - value 1
I am coming             - radio - value 2

Each of these invitees has a user id – I need the reponse to be with the user id.
The HTML for it looks like this:

<div>
<h1>Lady Mary S</h1>
<label for="no-1">I am not coming</label>
<input type="radio" value="1" id="no-1" name="response[1]" /><br />
<label for="yes-1">I am coming</label> 
<input type="radio" value="2" id="yes-1" name="response[1]" />
<input type="hidden" name="userid[]" value="1" />
</div>

<div>
<h1>Mister Hans S</h1>
<label for="no-2">I am not coming</label>
<input type="radio" value="1" id="no-2" name="response[2]" /><br />
<label for="yes-2">I am coming</label> 
<input type="radio" value="2" id="yes-2" name="response[2]" />
<input type="hidden" name="userid[]" value="2" />
</div>

<div>
<h1>Child of Mary & Hans S</h1>

<label for="no-3">I am not coming</label>
<input type="radio" value="1" id="no-3" name="response[3]" /><br />
<label for="yes-3">I am coming</label> 
<input type="radio" value="2" id="yes-3" name="response[3]" />
<input type="hidden" name="userid[]" value="3" />
</div>

These names will be fetched from MySQL with a unique nametag for these 3 people, f.x. MARHAN

This is a dynamic form – for some nametags there will only be two invitees and for other nametags there will be 3 or 4, etc.

My problems is that I cannot come up with a solution on how to handle the posted data so I can make sure the reponse is for the right user id.

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

    All you need is

    foreach($_POST['response'] as $userid => $value) {
          echo $userid.'-'.$value."<br>";
    }
    

    Because you already have userid in key of radio button name name="response[1]"

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

Sidebar

Related Questions

I have a form that gets its names for checkboxes dynamically. Is there a
I have a form that contains dynamically generated fields. There can be an arbitrary
I have a form that is dynamically created, on this form are several radio
I have a dynamic form that allow to add many fields dynamically, I Know
I have a Winforms application that dynamically instantiates external form objects for use in
I have a Greasemonkey script that dynamically inserts an HTML form into some web
I have several radio buttons that are dynamically populated on a form and I
Fact: I'm not that good with jQuery. Problem: I have a form containing dynamically
I have a form that sends money value e.g <input type=text name=amount value=N50,000.00 NGN
i have a form that is dynamically built. so the number of form elements

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.