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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:17:59+00:00 2026-05-31T19:17:59+00:00

In my html I have <input type=hidden name=Code_value value=xyz> <input type=hidden name=Code_value value=abc> <input

  • 0

In my html I have

<input type="hidden" name="Code_value" value="xyz">
<input type="hidden" name="Code_value" value="abc">
<input type="hidden" name="Code_value" value="rst">`

when i submit I take it in my ASp.net code I take them as

string Items = Request.Form["Code_value"]; 

the value of Items is xyz,abc,rst

in PHP $Items=$_POST['Code_value'];

The value of items is rst

It takes the last value in php is it because there are multiple Code_value items if so why is it not taking just the last value in Asp.net

  • 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-05-31T19:18:00+00:00Added an answer on May 31, 2026 at 7:18 pm

    This is simply down to the way PHP and ASP.NET read the request. If ASP.NET encounters the same form field name multiple times it will append the values. PHP, on the other hand, will overwrite the previous value with the current one, so you’ll only get the last value in $_GET or $_POST.

    You have two options.

    The first is to simply tell PHP to treat the fields in question as an array. This is the easiest approach because all you have to do is put square brackets at the end of the field name.

    <input name="field[]" value="1" />
    <input name="field[]" value="2" />
    <input name="field[]" value="3" />
    

    You can give each element in the array a particular key if you want too.

    <input name="field[foo]" value="1" />
    <input name="field[bar]" value="2" />
    <input name="field[baz]" value="3" />
    

    The other approach is to read the raw input the the script and process it yourself.

    $postdata = file_get_contents("php://input");
    

    This method is a lot more complex, as you have to parse all the input data yourself. It also has limitations.

    For that reason I’d recommend you use the first method.

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

Sidebar

Related Questions

I have the following HTML generated by an ASP.NET repeater: <table> <tr> <td><input type=hidden
I have the following HTMl: <input id=brandID name=brandID type=hidden value= /> <select id=selectList class=textfield70pc
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have HTML like this: <input type=radio name=type value=FL checked=checked />Fixed <input type=radio name=type
I have following HTML with two elements having the same name <input type=hidden name=
I have the below code in my .aspx page. <input type=hidden id=fbinfo name=fbinfo value=
I have html similar to this <input class=rowinput type=text id=text_input_1 size=1 value=3> <input class=rowinput
I have following HTML: <form action=/Config.aspx/SDKHome/SaveSections id=SaveSections method=post> <input name=[0].SchemaName type=hidden value=contactSection /> <ul
So I got this form: <form action=welcome.php method=post> <input type=hidden name=secret value=<?php echo getMyValue()
I have the following HTML: <input type=email id=email> I want to type text into

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.