![]() |
Radio button - 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: Radio button (/showthread.php?tid=55679) Pages:
1
2
|
Radio button - El Forum - 11-06-2012 [eluser]hujan[/eluser] so it that mean i don't need to have sap_yes,sap_no,sponser and my_sponser in my sap table column? and just replace 1) sap_yes and sap_no to sap_radio1 2)sponser and my_sponser to sap_radio2? Radio button - El Forum - 11-06-2012 [eluser]hujan[/eluser] i have rename my fields to sap_radio1 and sap_radio2...after i submitted the form, the radio button process does not get inserted into database, it only give me 0 for sap_radio1 and sap_radio2 fields. Radio button - El Forum - 11-06-2012 [eluser]noslen1[/eluser] Well it's hard to say when we don't know what the logic is, what you're trying to store and everything. What I can conclude from reading your posts is that you have in your form 2 radio buttons, with for each 2 possible data - sap_radio - Yes - No - sponser_radio - Sposer - No So in your database I think you should have 2 fields : - sap (BOOL), that can be TRUE or FALSE - sponser (VARCHAR), that can be 'Sposer' or 0, NULL... anything else Is that the behaviour expected ? Radio button - El Forum - 11-06-2012 [eluser]hujan[/eluser] in my form i have 4 radio buttons which are sap_yes, sap_no, sponser and my_sponser. sap_yes and sap_no indicate Yes and No resp. sponser and my_sponser will get Sponser and Half sponser. i have changed my sap table fields to sap_radio2(this field is to store Yes or No) and sap_radio2(this field is to store Sponser and Half sponser) ie: sap_radio1 -sap_yes -sap_no sap_radio2 -sponser -my_sponser Radio button - El Forum - 11-06-2012 [eluser]noslen1[/eluser] Okkkkk then, change both of your fields type sap_radio1 and sap_radio2 in your database to VARCHAR(16). Change your form view to : Code: <p> Then in your model : Code: $data = array( You should approach the final result Radio button - El Forum - 11-06-2012 [eluser]hujan[/eluser] my mistake..i re-write my code already to in view: Code: <p> in model: Code: $data = array('sap_radio1'=>$this->input->post('sap_radio1'), when i submitted the form I still get 0 value in sap_radio1 and sap_radio2 column inside the sap table Radio button - El Forum - 11-06-2012 [eluser]noslen1[/eluser] Change your database fields type to VARCHAR(16). It expects to have TINYINT(2) right now, and you try to insert STRING. PS : Rerewrite your view code with mine ![]() Radio button - El Forum - 11-06-2012 [eluser]hujan[/eluser] THANKS noslen1 and Rabbel. It works now :lol:.. Thanks for your help :-) |