![]() |
Conversion of my $_POST to CI and isset problem - 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: Conversion of my $_POST to CI and isset problem (/showthread.php?tid=39290) |
Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]Wondering Coder[/eluser] hello everyone, My Controller Code: function save_char_ref() I have a two problem which I need to resolve. 1. First the part where I'm using $_POST[$var], I would like to convert this to CI structure class which is $this->input->post() but don't know how to do this. 2. Second is my isset($_POST) function, even though my input value are empty it still save the data in my db. For more info this is my view Code: <form method="post" action="<?=base_url();?>stud_profile/save_char_ref"> Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]Wondering Coder[/eluser] anyone? T_T Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]steelaz[/eluser] Why "cr_fullname[]" and not simply "cr_fullname"? Edit: nevermind, noticed your JS Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]Wondering Coder[/eluser] so any idea how to convert this? and my isset function not working.? Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]steelaz[/eluser] Your isset() function is working fine. When you submit empty text field, it's still going to be included in $_POST array, so isset() will return true. If you want to check if something was entered in your text field, you can use empty() function, i.e.: Code: if (!empty($_POST['cr_fullname'][$i])) { }; Conversion of my $_POST to CI and isset problem - El Forum - 03-07-2011 [eluser]Wondering Coder[/eluser] thanks steelaz, got it working. ^_^. This is now my new controller: Code: function add() Is it ok to use $_POST instead of the $this->input->post in CI class? Even if i want it though I don't know how to do this with my current code. Because all of my other controller function used CI class for input except this one. Don't want it to look messy. (@_@) Conversion of my $_POST to CI and isset problem - El Forum - 03-08-2011 [eluser]steelaz[/eluser] Try this: Code: $myfield1 = $this->input->post('myfield1'); Conversion of my $_POST to CI and isset problem - El Forum - 03-08-2011 [eluser]Wondering Coder[/eluser] that did it. thank you very much steelaz... I owe you two. ^_^ |