How to call an array in add page from controller? May 18, 2020, 01:59:31 PM From few days I can't figure out the following:I want to call array in add.php! code:// in page event before add:......if(isset($_POST['update'])){ $fields = array("doc" => $_POST['doc'], "test" => "11111111111111111111111"); $this->set_flash_msg(get_lang('UPDATED! '), "success"); return $this->redirect("docs/add");}.....//in add.phpI have try so much different options in controller and add.php as: $modeldata['test']; $data = $this->view_data; request, view_data, $data['test'], I even make my own view functions and etc... and No it didn't work... due to some reasons, it clear the array and display blank: and gives Notice: Trying to access array offset … or print_r gives blank array etc...I call the controller to display other arrays from DB as well, that seems to be the main issue... as that calls are bellow in page, and mayby that is what clears my $post['update'] data? Please advice, how to call this array in add page?<?php// I want to call it this in add.php echo fields['doc'];echo fields['test'];//but how to do it? Quote Selected Last Edit: May 19, 2020, 10:19:30 AM by dobsun 1 Likes
Re: How to call an array in add page from controller? Reply #1 – May 19, 2020, 06:47:37 PM @dobsun please your question is not clear. Quote Selected
Re: How to call an array in add page from controller? Reply #2 – May 20, 2020, 12:04:54 PM @willvin Hi,I have a form add.php, there is few calculation have to be made and should be confirmed before real submit/inserting in a dbso I make one additional button with name='update', then in page events before add I put the code:if(isset($_POST['update'])){ $fields = array("doc" => $_POST['doc'], "test" => "11111111111111111111111", "uprice" => $_POST['uprice'], "qty" => $_POST['qty'],"total"=> $_POST['uprice']* $_POST['qty']); return $this->redirect("docs/add");}The idea is to update those values from the array in the form add.php!How to display it in add.php? Quote Selected Last Edit: May 20, 2020, 12:07:30 PM by dobsun
Re: How to call an array in add page from controller? Reply #3 – May 21, 2020, 12:32:46 AM @dobsun in Page Event, the lower section you will see the variables for accessing add page form data. It called $modeldata['fieldname']. Quote Selected
Re: How to call an array in add page from controller? Reply #4 – May 25, 2020, 01:59:21 PM @wilvin $modeldata dosen't return in add.php...I make work around with set/get_cookie thanks! Quote Selected
Re: How to call an array in add page from controller? Reply #5 – October 13, 2022, 12:21:42 AM señores, yo tambien tengo ese mismo problema, intente hacer todos los modelos de ejemplo posible, pero fue envano, alguna solucion o consejo, para mejorar esta herramienta, por favor Quote Selected