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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:18:55+00:00 2026-05-12T01:18:55+00:00

im pretty new to jQuery, and i dont know how to do that, and

  • 0

im pretty new to jQuery, and i dont know how to do that, and if it can be done without editing manually the plugin.

Assume to have a simply form like that:

<form action="page.php" method="post">
Name: <input type="text" name="Your name" id="contact-name" value="" />
Email: <input type="text" name="Your email" id="contact-email" value="" />
</form>

When you submit it, both in ‘standard’ way or with ajaxSubmit(), the values of the request take the label of the field name, so in the page.php i’ll have:

$_POST['Your name'];
$_POST['Your email'];

Instead i’ll like to label the submitted values with the id of the field:

$_POST['contact-name'];
$_POST['contact-email'];

Is there a way to do that with jquery and the ajaxsubmit() plugin?
And, maybe, there is a way to do it even with the normal usage of a form?

p.s: yes, i know, i could set the name and id attributes of the field both as ‘contact-name’, but how does two attributes that contain the same value be usefull?

  • 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-12T01:18:56+00:00Added an answer on May 12, 2026 at 1:18 am

    According to the HTML spec, the browser should submit the name attribute, which does not need to be unique across elements.

    Some server-side languages, such as Rails and PHP, take multiple elements with certain identical names and serialize them into data structures. For instance:

    <input type="text" name="address[]" />
    <input type="text" name="address[]" />
    

    If the user types in 1 Infinite Loop in the first box and Suite 45 in the second box, PHP and Rails will show [“1 Infinite Loop”, “Suite 45”] as the contents of the address parameter.

    This is all related to the name attribute. On the other hand, the id attribute is designed to uniquely represent an element on the page. It can be referenced using CSS using #myId and in raw JavaScript using document.getElementById. Because it is unique, looking it up in JavaScript is very fast. In practice, you would use jQuery or another library, which would hide these details from you.

    It is reasonably common for people to use the same attribute value for id and name, but the only one you need to care about for form submission is name. The jQuery Form Plugin emulates browser behavior extremely closely, so the same would apply to ajaxSubmit.

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

Sidebar

Related Questions

I am pretty new to jquery/javascript. Can someone please recommend a carousel plugin. So
I'm pretty new to jQuery/JS. But I have loop in jQuery where I would
I am pretty new to the zend framework and the JQuery helper. I have
So I'm using this pretty standard jquery plugin pattern whereby you can grab an
Im pretty new to jQuery (since a week) and don't understand why I can't
I know this sounds pretty trivial, but I'm new to jQuery... I use this
I'm pretty new to JQuery so I made my own light box that comes
I have a table that I've made sortable using the jQuery plugin Tablesorter 2.0
I'm pretty new to Jquery and i want to have a hidden div css:
I'm pretty new to jQuery, and I am converting a page from regular javascript

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.