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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:57:25+00:00 2026-06-04T02:57:25+00:00

I have multiple textbox with same name, example : <input type = text name

  • 0

I have multiple textbox with same name, example :

<input type = "text" name = "addCart"/> 
<input type = "text" name = "addCart"/>
<input type = "text" name = "addCart"/>
<input type = "text" name = "addCart"/>

If I do a $_Request from php and I want to get the value inputted only from the first and fourth textbox, how can I do it? Thanks

  • 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-04T02:57:26+00:00Added an answer on June 4, 2026 at 2:57 am

    You can’t. The last input box’s value will overwrite all of the other ones’ since they have the same name.

    What you could consider doing is using name="addCart[]"

    Then, $_REQUEST[‘addCart’] would be an array.

    Like:

    <input type="text" name="addCart[]" value="a">
    <input type="text" name="addCart[]" value="b">
    

    Then $_REQUEST[‘addCart’] (or $_POST or $_GET whichever you’re using) would contain an array of two strings ‘a’ and ‘b’.

    Edit: Just for completeness, I should note that this array is a normal array. Thus $_REQUEST[‘addCart’][x] where x is some integer index is valid as long as count($_REQUEST[‘addCart’]) > x.

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

Sidebar

Related Questions

I have multiple textboxes with the same class .input. Each textbox has different default
I have multiple textboxes which I want them to perform the same thing upon
I have a form with multiple textboxes with the same names. I want to
I have multiple textboxes with TextChanged events bound to the same handler <TextBox TextChanged=TextBox_TextChanged
I have a Custom Control that has multiple textbox fields and a checkbox contained
i have a single textbox named Keywords. User can enter multiple strings for search.
I have a text box that will allow the user to enter multiple authors
I have multiple (8) WAR files and 1 EAR file that I want to
I have multiple threads who all need to write to the same Dictionary. I
I have multiple text files with logged data like this: 6/23/09 17:00 0.443 6/23/09

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.