Welcome Guest, Not a member yet? Register   Sign In
(solved) Form Flow and Variable Scope
#1

[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?
#2

[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.




Theme © iAndrew 2016 - Forum software by © MyBB