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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:44:16+00:00 2026-06-04T04:44:16+00:00

I have multiple forms in my page and depending on the hidden input value,

  • 0

I have multiple forms in my page and depending on the hidden input value, different sections are called.

Now my issue is, I have 2 input buttons in one of my forms, and depending on what button I click i need to send the appropriate hidden input type,

For example in the below form .
If i click on Generate password button,
I want the target value(the value of the hidden input field) as generate_password

If I click on Lock Password I want the target value to be user_locked. Here is my code.

    puts "<input type=\"hidden\" name=\"target\" value=\"user_locked\">"
    puts "<tr><td colspan='4'> New User request Review</td></tr>"
    puts "<tr><td><label for=\"full_name\"> Full Name </label></td>"
    puts "<td><input type=\"text\" value =\"$name\" name =\"full_name\" readonly=\"readonly\"></td>"

    puts "<tr><td><input type=\"button\" value=\"Generate Password\" onclick=\"if(confirm('Are you user you want to add this user?')){submit()};\"></td>"
    puts "<td><input type=\"button\" value=\"Lock User\" onclick=\"if(confirm('Are you user you want to add this user?')){submit()};\"></tr>"

well basically I am calling different functions depending upon the hidden field,

set target "";      catch { set target $CGI_DATA(target) }
switch $target {
    "confirm"   { set id [UpdateUserData $id] }
    "user_locked    { DeleteUser $id }
    "user_confirmed"        { NewUserConfirmed}
    "newuser"   { NewUserReview }
    default     { }
}
  • 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-04T04:44:18+00:00Added an answer on June 4, 2026 at 4:44 am

    The code to your onclick event could do that when confirming instead of just submitting the form. If you use jQuery:

    if(confirm('Are you user you want to add this user?')){
        $("input[name=target]").val('Generate password');
        submit();
    }
    

    The one for the other input button should be very similar.

    It is also possible that you have a way of knowing which button was pressed to submit the form another way. If I remember correctly, in PHP at least the name of the button is passed through in the _REQUEST variable.

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

Sidebar

Related Questions

I have a page with multiple forms using different .php pages to process and
I have a page that has multiple forms. Anytime the user clicks an input
I have multiple slider forms in my page: like this one . For just
I have a question concerning multiple similair forms on one page. Lets say you
I have a page that loads different forms depending on user choice. I want
I have a page where multiple forms are submitted to different 3rd party sites...I
Is it possible to have multiple contact forms on one page and still validate
How is it possible to have multiple forms on a page with each one
I have multiple forms on a page, for each of them I want the
I have multiple ajax forms on page that cointain same elemets, I have jquery

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.