CodeIgniter Forums
(solved) Form Flow and Variable Scope - 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: (solved) Form Flow and Variable Scope (/showthread.php?tid=7023)



(solved) Form Flow and Variable Scope - El Forum - 03-20-2008

[eluser]zimco[/eluser]
My application is moving through a few screens of forms and all was going well until i got to the last one.

I have a function in the myform controller:
Code:
/*======================================================================*\
    Function:    showdropdownform($htmlfile)
    Purpose:    Grab a FORM out of a html file located on local server
    Input:        the path to the html file
    Output:        A drop down FORM
\*======================================================================*/
function showdropdownform($htmlfile)
    {
        $this->load->library('snoopy');
        $this->load->helper('file');
        
        $string = read_file($htmlfile);
        $this->snoopy->results = $this->snoopy->_stripform($string);

        $data = new Snoopy();
        $this->load->view('raceform_view', $data);

     }

The raceform_view simply shows the form i stripped out of the html file, and the form action is to invoke another controller raceform/index where the user's choice from the dropdown menu is transferred to a function that is supposed to open up the exact same html file: $htmlfile referenced previously in the other myform controller function showdropdownform.

Can i pass along the variable $htmlfile thru the raceform_view and to the next controller some way?


(solved) Form Flow and Variable Scope - El Forum - 03-21-2008

[eluser]zimco[/eluser]
Solved by passing the information in a hidden field in the form:
Code:
<input type=\"hidden\" name=\"htmlfile\" value=$htmlfile>

Not a particularly good solution as the full directory path to the file is shown but it gets the job done.