Welcome Guest, Not a member yet? Register   Sign In
Problem with passing variable from controller to view
#1

[eluser]condoace[/eluser]
I am trying to use a jquery modal window/ pop up window after the user has submitted the form and it was successful. I have created a flash data from the controller but for some reason the view file does not recognise the flash data or something is going wrong.. please have a look at my code, any ideas would be helpful!

VIEW

Code:
<?php if ($this->session->flashdata('result') != '') {

echo '<type="text/javascript"> // I just remove "script" as the forum wont allow it
$.prompt("finished");
[removed]'; // "script" is here, forum has removed it

}?&gt;

CONTROLLER
Code:
function keep_tuned() {
  
  
   $this->load->library('form_validation');
  
   // validate form input
  
   $this->form_validation->set_rules('name','Name','trim|required');
  
   $this->form_validation->set_rules('email','Email','trim|required|valid_email');
  
   $this->form_validation->set_rules('company','Company','trim|required');
    
   $valid = $this->form_validation->run();
  
   if($valid == false) {
    
    $this->load->view('view_launch.php');
            
   }
  
   else {
    
    $name = mysql_real_escape_string($this->input->post('name'));
    
    $email = mysql_real_escape_string($this->input->post('email'));
    
    $company = mysql_real_escape_string($this->input->post('company'));
    
    $this->load->model('Model_launch');
    
    if($query = $this->Model_launch->enquiry($name,$email,$company))
    {
          
     $this->session->set_flashdata('result','test');
    
     $this->load->view('view_launch',$data);
    
    
    }
    
    else
    {  
    
     $this->load->view('view_launch');
    
    }  
      
   }
    
  }


Messages In This Thread
Problem with passing variable from controller to view - by El Forum - 03-06-2012, 09:04 PM
Problem with passing variable from controller to view - by El Forum - 03-07-2012, 02:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB