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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:13:44+00:00 2026-06-07T21:13:44+00:00

I was wondering, I have a 2 input submit on my form. One has

  • 0

I was wondering, I have a 2 input submit on my form.
One has a name :

<input name="_close" type="submit" id="myId" value="close">

And when I click on it, i submit the form via (after doing things in JS)

$('#myForm').submit();

Then in my server code I test on the Request if it has the query “_close” but it does not seem to be the case.

My question is :
Is there a way to make the jQuery method .submit() preserve the name of the input button clicked or to manually specify to the .submit() function the extra parameter I want in my next Request ?

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-07T21:13:47+00:00Added an answer on June 7, 2026 at 9:13 pm

    Im not sure about submit buttons and how /if they are passed across however if they are not you could in your pre submit javascript assign the value to a hidden input of the same name.

    Ive just run an example for you.

    test.html

    <form action="test.php" action="POST" >
        <input type="submit" name="submitButton" value="Click me to submit" />
    </form>
    

    test.php

    <?php
        echo $_POST['submitButton'];
    ?>
    

    This does echo Click me to submit

    I then did another test using the submit function in jquery which does not pass the value over.

    The reason is so that you can test server side which submit button was pressed since you may have more than one submit button on the form. Checking the value allows you to test which one it was specifically that was used to submit the form.

    To allow you to use an external input as a particular submit button so that its name/value pair is passed in the request instead of calling submit() on the form in your jquery, select the submit button itself and call click() on it. This will tell the form that that particular submit button was used and therefore set its value in the request.

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

Sidebar

Related Questions

I have this fairly simple form: <form action=...> <div> <input type=text class=input-text value= name=text
Let's say I have markup like this: <form action=foo> <input name=bar /> <button type=button>Save</button>
i have a form on a page with a hidden input with the name
I have a form I want to submit via PHP and following submission I
I have the following: <script type=text/javascript> function CancelFormButton(button) { $(button.form).submit(); } </script> <form onsubmit=alert('here');>
Hey guys I have a system where there is one form for each friend
I'd like to submit a form using GET but without passing the value of
If have a filter form with multiple filter control inside like first name, last
Wondering if it is ok to have a form inside an HTML email. All
If I have a form element as given below, then calling the form's submit

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.