Single html Form With Multiple Submit Buttons - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Single html Form With Multiple Submit Buttons (/showthread.php?tid=36676) Pages:
1
2
|
Single html Form With Multiple Submit Buttons - El Forum - 08-08-2014 [eluser]Tim Brownlaw[/eluser] Not exactly sure what you are trying to show here Bill! But your Block [8500] won't display any values for the post variables named preview or create because they do not exist in the form! Code: // +---------+---------+---------+---------+---------+---------+ The following is Soley For Debug Purposes to see what is happening!!! Code: // +---------+---------+---------+---------+---------+---------+ Interesting Note: When echoing a string with a concatenated ternary like... Code: echo '<br>[8511] I do something but '. ($this->input->post('preview')===false)?'I Do Not Exist':'I do Exist' Code: '<br>[8511] do something but '. Single html Form With Multiple Submit Buttons - El Forum - 08-09-2014 [eluser]CroNiX[/eluser] Code: $this->input->post('preview') Single html Form With Multiple Submit Buttons - El Forum - 08-09-2014 [eluser]Tim Brownlaw[/eluser] @CroNiX well that's the short answer! Single html Form With Multiple Submit Buttons - El Forum - 08-09-2014 [eluser]Unknown[/eluser] I just started trying to learn CodeIgniter a couple of days ago, and needed some info on how to use two, or more submit buttons, and that's how I found this thread. ( 1 ) This shows the first approach to solving the problem. Obviously none of this is my original work, it is based on this thread and its contributors. I just tested in a sample project and now display the two approaches. It is all debugging code. Using this approach the button names are different, and the button values are not used, this is a key point. So, it is about showing two different ways of getting the two buttons to do something different. Code: <!-- approach ( 1 ) --> ( 2 ) I had looked at the code and comments described by other users on this thread, and tried to make sure their code worked for me. The first time around I could not make the first approach [8500] above work until I realized that the names had to be different. For the second approach [8400], and [8600], the button names are the same, and the button values are used to differentiate which button was clicked, this is also a key point. Code: <!-- approach ( 2 ) --> |