Carry form element value to button or link - 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: Carry form element value to button or link (/showthread.php?tid=3163) |
Carry form element value to button or link - El Forum - 09-13-2007 [eluser]Unknown[/eluser] I have a form with radio buttons to select. I have 2 buttons: 1 is "Create New STyle", other is "List selected Style." I like to get the value of radio button value into the link of these 2 buttons. For example, if radio A is selected, "createAStyle.php" or "viewAStyle.php" should be opened after a button is clicked. Is there anyway to 2 buttons for 1 form? How to concatenate the value into the link? Carry form element value to button or link - El Forum - 09-13-2007 [eluser]Michael Wales[/eluser] Make the form go to the same controller and give your submit buttons name attributes. In that controller, determine which button was pressed and load that particular view. You could also redirect() from the form processing controller, but you would lose the value of your radio field. Carry form element value to button or link - El Forum - 09-15-2007 [eluser]eedfwChris[/eluser] You could only use redirect if you are not trying to submit other form data fields (because redirect doesn't send the post variables AGAIN). So you could do: Code: function do_style() Also, keep in mind the redirect kinda makes the browser history screwy so only use it when you are certain it should exist and the user is unlikely to hit "back" in their browser. |