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

The Archive Base Latest Questions

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

I have a form, which take name from form and it sends to javascript

  • 0

I have a form, which take name from form and it sends to javascript codes and show in php by Ajax. these actions are done with clicking by submit button, I need to have another button, as review in my main page. how can I address to ajax that in process.php page have “if isset(submit)” or “if isset(review)”?
I need to do different sql action when each of buttons are clicked.
how can I add another button and be able to do different action on php part in process.php page?

<script type="text/javascript">
    $(document).ready(function(){
        $("#myform").validate({
            debug: false,

            submitHandler: function(form) {
            $.post('process.php', $("#myform").serialize(), function(data) {
                    $('#results').html(data);
                });
            }
        });
    });
    </script>
<body>
<form name="myform" id="myform" action="" method="POST">  
      <label for="name" id="name_label">Name</label>  
    <input type="text" name="name" id="name" size="30" value=""/>  
    <br>
    <input type="submit" name="submit" value="Submit"> 
</form>
    <div id="results"><div>
</body>

process.php:

<?php

    print "<br>Your name is <b>".$_POST['name']."</b> ";
?>
  • 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-04T17:52:46+00:00Added an answer on June 4, 2026 at 5:52 pm

    You just need to add a button and an onclick handler for it.

    Html:

    <input type="button" id="review" value="Review"/> 
    

    Js:

    $("#review").click(function(){
                var myData = $("#myform").serialize() + "&review=review";
                $.post('process.php', myData , function(data) {
                        $('#results').html(data);
                    });
                }
            );
    

    Since you have set a variable review here, you can use it to know that is call has come by clicking the review button.

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

Sidebar

Related Questions

I have a web form to which I want to take a parameter from
I have a form which has a ListView and buttons to add/edit/delete items from
I have a form which I create manually (a lot of JavaScript in it...).
I have a form which has a collection for manager which is an autocomplete
I have a form which I wish to be be represented graphically elsewhere on
I have a form which is dynamically generated based on user input. Initially the
I have a form which has a drop down list for countries. If the
I have a form which allows my user to edit the information as required.
I have a form which contains a checkbox field. On page load I want
I have a form which I am validating through the jQuery Validate plugin. Everything

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.