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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:45:09+00:00 2026-05-25T18:45:09+00:00

I am developing a web app but running into a few small snags. I’m

  • 0

I am developing a web app but running into a few small snags. I’m using CodeIgniter.

I want to have 2 buttons that will do execute 2 different functions that do different things to the database. I have these functions made in the proper Controller file.

What is the best way to go about making the buttons execute their respective functions? If it requires javascript, I have no problem making it, just need some pointers as I’m a little bit confused here!

  • 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-25T18:45:10+00:00Added an answer on May 25, 2026 at 6:45 pm

    If they’re making changes to records in the database, you should probably implement them as part of a form (or two). Potentially destructive actions should not be executable just using a simple GET request.

    The form(s) can contain a hidden input type to specify what you want to in the controller.

    HTML page:

    <form action="controller/myfunction" method="POST">
        <input type="hidden" name="action" value="one">
        <input type="submit" value="Do action one">
    </form>
    
    <form action="controller/myfunction">
        <input type="hidden" name="action" value="two">
        <input type="submit" value="Do action two">
    </form>
    

    Controller:

    function myfunction()
    {
        // Your form would be submitted to this method...
        // Get action from submitted form ('one' or 'two')
        $action = $this->input->post('action');
        // Decide what to do
        switch ($action)
        {
            case 'one': $this->my_first_action(); break;
            case 'two': $this->my_second_action(); break;
        }
    }
    
    function my_first_action()
    {
        // Do stuff...
    }
    

    It would be good practise to redirect to another page once the form has been submitted – use the ‘Post/Redirect/Get‘ pattern.

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

Sidebar

Related Questions

I'm developing a web app and currently using sql server 2008 for it. But,
I am developing a web app using servlets and jsps. I have a question
I have been developing my web-app using JPA 2.0 implementation EclipseLink 2.2.0. I finally
This is probably a simple question but I am developing a web app in
I'm developing a web app on Yaws 1.65 (installed through apt) running on Debian
I am developing a web app but is not satisfied with is architecture that
When developing a web app, in my case a ASP.NET MVC app, but this
I am developing web forms app in C# Framework 3.5 I want to build
I am developing a web app that is supposed to have the feeling of
I am developing a mobile web app. Currently I have this snippet of 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.