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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:05:11+00:00 2026-05-25T16:05:11+00:00

I’d like to have a submit button that submits a different value than is

  • 0

I’d like to have a submit button that submits a different value than is displayed on the button. With <input type="submit"> you can’t seem to do this. With <button type="submit"> however, these can be two different values. The question is, will it work in all browsers?

Trying this test code here:

<form method="get" action="">
    <input type="text" name="txt"/>
    <button type="submit" name="btn" value="val">text</button>
</form>

In FF 3.6 it updates my address bar with both values appropriately (and responds to me pressing enter in the text box). In IE 8, it also accepts pressing enter, displays the text value in the address bar, but it doesn’t show the button’s value as a GET param at all… does that mean it’s not submitting it?


I can’t use hidden inputs because I need to determine which button is clicked without JS.


Test 2:

<form method="get" action="">
    <input type="text" name="txt"/>
    <button type="submit" name="submit1" value="submit1">submit</button>
    <input type="submit" name="submit2" value="submit2"/>
    <input type="submit" name="submit3" value="submit3"/>
</form>

In IE8, hitting enter does not submit any of the buttons, but clicking submit1 will send a value. It’ll send “submit”, not “submit1” which is inconsistent with FF. However, submitting the form only sends the value of one button in both browsers, which means I might be able to check which button was clicked by checking if GET['submitX'] exists instead! Chrome has slightly different behavior on pressing enter (submits button2). Opera seems consistent with FF… but all 4 browsers only ever submit one button. I don’t have any earlier versions of the browsers installed though…. does anyone know if it works in earlier versions, particularly IE6?

  • 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-25T16:05:11+00:00Added an answer on May 25, 2026 at 4:05 pm

    Oldish post but I think there is a solution that has been missed here. The button[type=submit] has always had problems with inconsistent behaviour, particularly with old IEs, and from @Mark’s tests looks like we still have problems.

    Instead you can use two different values for the name attribute of the input[type=submit] and parse these server-side to get the correct action. For example, you can do:

    <form method="get" action="">
        <input type="text" name="txt"/>
        <input type="submit" name="action[do_something]" value="Do Something Cool"/>
        <input type="submit" name="action[do_another]" value="Do Something Dangerous"/>
    </form>
    

    Only the successful (clicked or default) name-value pair gets submitted so, say, in PHP you can easily do something like:

    <?php
    if (isset($_GET['action']['do_something'])) {
        // do something
    } else {
        // do another thing
    }
    ?>
    

    Note the default action will always be the first that appears in the source.

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

Sidebar

Related Questions

I have text I am displaying in SIlverlight that is coming from a CMS
I've got a string that has curly quotes in it. I'd like to replace
I have some data like this: 1 2 3 4 5 9 2 6
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a JSP page retrieving data and when single or double quotes are
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.