Jump to content

Robinson

New Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Robinson

  • Rank
    Newbie
  1. By "a (weird) mechanism ", I assume you mean these lines: function includeFile($file,$variable) { $var = $variable; include($file); } Could get rid of this line and the pidForApproval can get passed into the included file automatically? Is it advisable? Thanks.
  2. First let me explain my code. It comprises of three php files. inc_fn_header_and_menu.php, contains the HTML and CSS header details and it initializes the session via session_start(); This is later included in project_status.php] . In project_status.php] , I have included another file project_status_app.php which contains a HTML form. project_status.php: <?php include 'inc_fn_header_and_menu.php'; function includeFile($file,$variable) { $var = $variable; include($file); } if (isset($_GET['id']) && $_GET['id']!="") { $pid
  3. Okay,But the issue is that the inc_fn_header_and_menu.php file is a shared file, it has been already included in all other files. To remove session_start(). I will have to include session_start() in all those files.
  4. I had set this value into the super global $_SESSION in the first file, file_1.php: <?php //there is some code here $_SESSION['salesorder'] = 'are---io'; //remaining code, includes a form. ?> When the submit button is clicked, the form is submitted to file_2.php <?php //some code over here if (isset($_POST['sales']) && $_POST['sales'] != ""){ $sales = sanitize_input(trim($_POST['sales'])); $_SESSION['salesorder'] = $sales; $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'processSO_helper_sd.php'; heade
  5. Thank you Barand, I have tried out your suggestion and it has worked. However, I have one question, it is about these lines: } else { print_r($years_arr); return $years_arr; How is it that it manages to print $years_arr but it doesn't return the $years_arr. Also, can you point me to some resources(books, websites) that teach about Recursion in PHP, they are hard to come by and most books, at least the ones I obtained, delve on the subject very briefly. And, no, this is not an entry into a competition :)), it is a small portion of a bigger program.
  6. Dear all, Kindly help with this code I have written, it is not returning the array I created. It is a very small script but I have been looking for a very long time but I couldn't see why it went wrong. $duration = 2; $start='01-01-2019'; $month =date('n', strtotime($start)); $year =date('Y', strtotime($start)); $mon = 12-$month+1; $remainingMonth = $duration*12; $years_arr = array("$year"); $residue_arr = array("$remainingMonth"); $years_arr = process($remainingMonth,$year,$mon,$years_arr,$residue_arr); print_r($years_arr); //<output function process($remainingMonth,$year,$mon
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.