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?
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 !