function find_selected_film()
{
    /*
      This allows me to call a films name, genre, etc. as a variable when the 
      id has been passed to the url. If there is no id in the url, it will randomly 
      generate one. It is super useful in recommend.php, as it ensure that a film 
      will always be displayed on the page.
    */
    global $current_film;
    global $film_name;
    global $release_date;
    global $genre;
    global $summary;
    global $wrote;
    global $acted;
    global $directed;
    global $runtime;
    global $female_lead;
    global $male_lead;
    global $quote;
    global $image_location;
    if (isset($_GET["film"])) {
        $current_film = get_film_by_id($_GET["film"]);
        $film_name = htmlentities($current_film["film_name"]);
        $release_date = htmlentities($current_film["release_date"]);
        $genre = ucwords($current_film["genre"]);
        $summary = htmlentities($current_film["summary"]);
        $wrote = htmlentities(binary_to_words($current_film["wrote"]));
        $acted = htmlentities(binary_to_words($current_film["acted"]));
        $directed = htmlentities(binary_to_words($current_film["directed"]));
        $runtime = htmlentities($current_film["runtime"]);
        $female_lead = htmlentities($current_film["female_lead"]);
        $male_lead = htmlentities($current_film["male_lead"]);
        $quote = htmlentities($current_film["quote"]);
        $image_location = htmlentities($current_film["image_location"]);
    } else {
        $random_film_id = generate_random_id();
        $new_address = "recommend.php?film=" . $random_film_id;
        redirect_to($new_address);
    }
}
 /**
  * Edit
  *
  * Lets you edit and existing record from the database.
  * When called for the first time, it will fetch the record details from the database 
  * and pre fill the the form fields.	
  * If the form is posted then the posted values will be set in the variables.
  * It is necessary to declare a variable and define a default value.
  *
  * @access	private
  * @param	array
  */
 function edit($id, $frm = array())
 {
     $id = (int) $this->uri->segment(4);
     $check_priviledge = $this->validate_priviledege($id);
     if (!$check_priviledge) {
         $message = "You don't have Sufficient Priviledge to Edit these page";
         $this->session->set_flashdata('invalid_access', $message);
         redirect($this->page_name);
     } else {
         $mode = isset($frm['mode']) ? $frm['mode'] : "";
         $this->session->set_userdata("page_action", "Edit");
         if ($id == "") {
             $id = $this->input->post('id');
         }
         if ($id == 0 || empty($id)) {
             redirect($this->page_name);
         } else {
             if ($mode != "update") {
                 $result = $this->db_interaction->get_records_where('id', $id);
                 $cnt = count($result);
                 if ($cnt > 0) {
                     $frm = $result[0];
                     $frm["page_parent"] = $frm["page_parent_id"];
                 } else {
                     redirect($this->page_name, "refresh");
                 }
             } else {
                 $result = $this->db_interaction->get_records_where('id', $id);
                 $frm = $result[0];
                 $frm["page_parent"] = $frm["page_parent_id"];
                 $frm["featured_image_name"] = $frm["featured_image_name"];
             }
         }
         $token = generate_random_id();
         $this->session->set_userdata("token", $token);
         $list_pages = "";
         $list_pages = $this->mapTree($frm["page_parent"], $id);
         //INDICATOR THAT WE NEED A BASE PAGE
         //JUST TO PREVENT IOVERLAPPING OF STRING
         $this->option_list = '';
         $redirect_pages = "";
         $redirect_pages = $this->redirect_mapTree($frm["redirect_page_id"]);
         /*$list_pages_featured = "";
         		$list_pages_featured = $this->_build_tree_featured($frm["page_featured_page"],$id);*/
         $list_pages_featured = "";
         $list_pages_featured = $this->_get_featured_pages();
         $web_magnet = $this->page_db_interaction->web_magnet();
         $wm_client_status = $web_magnet['wm_client'];
         $wm_status = $web_magnet['wm_status'];
         $version_details = $this->db_interaction->get_version_details($id);
         $verison_selected_id = $this->input->post('verison_selected_id');
         $version_number = $this->_version_number_details($version_details, $verison_selected_id);
         $data = array("pagetitle" => "Update Page : '" . $frm["page_name"] . "'", "pagetitle_sub" => "Page Data", "id" => $frm["id"], "wm_client_status" => $wm_client_status, "wm_status" => $wm_status, "page_name" => $frm["page_name"], "page_header" => $frm["page_header"], "page_footer" => $frm["page_footer"], "page_meta_keywords" => $frm["page_meta_keywords"], "page_meta_description" => $frm["page_meta_description"], "page_h1" => $frm["page_h1"], "seo_content" => $frm["seo_content"], "page_head" => $frm["page_head"], "page_title_tag" => $frm["page_title_tag"], "page_html_data" => $frm["page_html_data"], "page_include_file" => $frm["page_include_file"], "page_featured" => $frm["page_featured"], "featured_image" => $frm["featured_image_name"], "page_featured_page" => $frm["page_featured_page"], "page_parent" => $frm["page_parent"], "status" => $frm["status"], "display_footer" => $frm["display_footer"], "hide_client" => $frm["hide_client"], "menu_frontend" => $frm["menu_frontend"], "token" => $token, "dashboard_category" => $this->list_dashboard_category($frm['dashboard_category']), "version_number" => $version_number, "version_details" => $version_details, "verison_selected_id" => $verison_selected_id, "submit_name" => "update", "submit_value" => "Update Page", "list_pages" => $list_pages, "redirect_page_id" => $redirect_pages, "list_pages_featured" => $list_pages_featured, "page_parent_original" => $frm["page_parent"], "msg" => $this->msg, "errors" => $this->errors);
         if (isset($frm["featured_image_name"])) {
             $data['featured_image'] = $frm["featured_image_name"];
             $data['featured_flag'] = $frm["featured_image_new_flag"];
         }
         // load view and add additional data
         $this->_display("add", $data);
     }
 }