PHP Scrit in C.I Method - Convertion - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: PHP Scrit in C.I Method - Convertion (/showthread.php?tid=74412) |
PHP Scrit in C.I Method - Convertion - Porto - 09-20-2019 Hello Guys, Can someone please help me to convert this procedural php script in the C.I method? I would be immensely grateful I'm trying, but i'm doing something wrong. Thank you in advance. This is the procedural script PHP: Code: <?php This is the html Form: Code: <form action = "u_ifelse1.php" method = "post"> Now there comes my try - 1° CI_Controller: Code: class U_ifelse1 extends CI_Controller{ 2° The form - home_23.php Code: <body> 3° - Third file home_24.php Code: <body> RE: PHP Scrit in C.I Method - Convertion - php_rocs - 09-20-2019 @Porto, Maybe these links will help you... https://codeigniter.com/user_guide/libraries/form_validation.html?highlight=form%20validation#form-validation-tutorial https://codeigniter.com/user_guide/tutorial/index.html#tutorial RE: PHP Scrit in C.I Method - Convertion - Wouter60 - 09-21-2019 Give all your inputs names, including the submit button. You can use the name "submit". Your controller should load the form view only if "submit" wasn't posted. The common logic for a function like that is: PHP Code: if (! $this->input->post('submit')) { The line PHP Code: if ($Form_data['form_fields'] == "N" ) doesn't make sense, because $form_data['form_fields'] is an array with all post values. To determine if $sorte == "N", do this: PHP Code: if ( $this->input->post('sorte') == 'N') { |