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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:48:26+00:00 2026-05-16T04:48:26+00:00

I have a form in CodeIgniter, and I need to change the Action of

  • 0

I have a form in CodeIgniter, and I need to change the Action of the form based on what is in the actual form.

ie: if <select name="type"> == business then I need action="business/submit"

Is there a simple way to do this?

Right now my attempted workaround is to use Javascript to grab the data from the inputs, then send it to a dynamically generated link – however it’s not ideal for my situation.

Thoughts?

  • 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-16T04:48:27+00:00Added an answer on May 16, 2026 at 4:48 am

    I have never worked on CodeIgniter but I can tell you how you can do it in PHP.

    You have to understand that you cannot do this “dynamically” without Javascript. As you suggested that you do not wish to use Javascript, I am suggesting a dirty way to handle this situation.

    You cannot modify the action attribute with PHP alone, so we will have to post it to one PHP file and then based on the selection (from your select box) you can include the file that you need. You can use switch case or if based on your preference.

    This is just indicative. Please do not flame me for not following standards or not taking any security measures !

    <?php 
         // sample code snippet 
    
          if($_POST['type']=== 'something') { 
              include 'something.php'; 
          } 
          else if($_POST['type']=== 'somethingElse') { 
               include 'somethingElse.php'; 
          } 
          else { 
               include 'totallyDifferentOne.php'; 
          }
    
         // continue your code 
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Kohana/CodeIgniter, I can have a URL in this form: http://www.name.tld/controller_name/method_name/parameter_1/parameter_2/parameter_3 ... And then
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have a form with many input fields. When I catch the submit form
I have a simple form in codeigniter that I wish to use for the
I am using Codeigniter framework and I have a form with input fields. When
I'm building an app in CodeIgniter. I have an invoice form which uses jQuery
I have a form which uploads multiple file fields into a db using codeigniter.
I have form area in my view. If I click button A , I
I have form that displays several keywords (standard set of choice lists that changes
I have a form in C# that has a button that, when clicked, I

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.