Magic Form - Need Explanation - 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: Magic Form - Need Explanation (/showthread.php?tid=13597) |
Magic Form - Need Explanation - El Forum - 11-28-2008 [eluser]purpleparasol[/eluser] I have coded two forms and please note **they are behaving as I would like**, but I don't know why. If I put the code here can someone explain why it is working. I have a simple form on a view, with its own controller like this Code: <?=form_open('newslettersignup'); ?> When someone fills in the values and clicks on the submit button, it goes to a different controller called newsletter signup which shows another form like the one below. Code: <?=form_open('newslettersignup'); ?> The second form contains the values for name, email and country that the first form contained, which is what I wanted to happen. My question is - how did I do this? What is making the second form contain the same values as the first form when I don't think I've done anything explicitly to make this happen. Is it the set_value call? Apologies if this sounds daft, but I've done what I want to do with no idea how I did it. Not really sure what set_value does when the values were in another, separate form. Magic Form - Need Explanation - El Forum - 11-28-2008 [eluser]GSV Sleeper Service[/eluser] set_value is doing that. it will set the value to whatever is in the current $_POST, if the name exists. it also looks at the validation values too, neat! The user guide doesn't mention this at all... from the source code - Code: /** Magic Form - Need Explanation - El Forum - 11-28-2008 [eluser]purpleparasol[/eluser] Thank you - GSV Sleeper Service. |