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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:08:18+00:00 2026-06-01T04:08:18+00:00

I have 3 buttons in my html page, say ADD , UPDATE & DELETE

  • 0

I have 3 buttons in my html page, say ADD, UPDATE & DELETE. And I have written a PHP class DBComm in a PHP file dbutils.php which contains three functions add(), update() & delete() for adding, updating & deleting data in the database.

What I want to do is, on submission of the page, I want to create an instance of the PHP class and would be able to call the corresponding PHP function in that class. I wrote the AJAX code,

xmlhttp.open("POST", "dbutils.php", true);

But, if I write like this, I may need to use three php files for handling each event, like Add.php, Update.php & Delete.php. Is there any option in AJAX for creating an instance of the class and to invoke a particular function in that class so that I can keep all the related things in the same place, ie in the class itself?

  • 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-01T04:08:19+00:00Added an answer on June 1, 2026 at 4:08 am

    you can send parameters with xmlhttp

    xmlHttp.open("POST", "dbutils.php", true); 
    var params = "function=" + function + "&paramater=" + parameter; 
    xmlHttp.send(params); 
    

    on the php side in dbutils file you can use your function. for example

    function add(){}
    function delete(){}
    function edit(){}
    if(in_array($_POST['function'],array('add','edit','delete'))
    {
         //call the function
         $_POST['function']();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form on an HTML page with multiple submit buttons that perform
i have a Button on a HTML page . i want to attach file
Let us say i have a page http://www.abc.com/xyz.html and i am going to access
I have an HTML page (say welcome.html) which contains an iframe to a page
I have a button that, when pressed, will add a new HTML row. Within
I have a following HTML : <ul class=someclass> <li id=1> <button type=button class=grey></button> </li>
I have noticed the following with my page thePage.php. My page thePage.php has a
Say I have the following in my models.py : class Company(models.Model): name = ...
Context Let`s say i have: In layout Site.Master: <div class=leftColumn> <asp:ContentPlaceHolder ID=MainContent runat=server />
I have a aspx page and a js file, am accessing the js file

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.