Welcome Guest, Not a member yet? Register   Sign In
Need FLASH DATA NEED HELP
#1

[eluser]razerone[/eluser]
HI I am trying to have s div show up on my form for flash data that will only show up when message sent successfully the div i am trying to display at bottom of form is <div class="alert alert-success">Flash Data</div>

I had it going but when did it showed up on the normal contact page as well and the confirmation section redirect. I have read user guide but can't get it right.

Here is my php

Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Contactus extends MX_Controller {

public function index() {

  $this->load->library('googlemaps');

  $config = array();
  $config['center'] = 'Australia';
  $config['zoom'] = '5';

  $this->googlemaps->initialize($config);

  $data_map['map'] = $this->googlemaps->create_map();

  $this->load->view('header', $data_map);
  $this->load->view('contactus');
  $this->load->view('footer');

}

public function confirmation() {

  $this->load->library('email');
  $this->load->library('googlemaps');
  $this->load->library('session');
  $this->load->library('form_validation');

  $this->form_validation->set_rules('fullname', 'Your Full Name', 'required');
  $this->form_validation->set_rules('email', 'Your Email', 'required|valid_email');
  $this->form_validation->set_rules('subject', 'Your Subject', 'required');
  $this->form_validation->set_rules('message', 'Your Message', 'required');

  if ($this->form_validation->run() == FALSE) {

   $config = array();
   $config['center'] = 'Australia';
   $config['zoom'] = '5';

   $this->googlemaps->initialize($config);

   $data_map['map'] = $this->googlemaps->create_map();

   $this->load->view('header', $data_map);
   $this->load->view('contactus');
   $this->load->view('footer');

  } else {

   $fullname = $this->input->post('fullname');
     $email = $this->input->post('email');
     $subject = $this->input->post('subject');
     $message = $this->input->post('message');
    
    $this->email->set_newline("\r\n");
    $this->email->from($email, $fullname);
    $this->email->to('[email protected]');
    $this->email->subject($subject);
    $msgBody = "Full Name:" . " \n\n" . $fullname . " \n\n" .
          "Email:" . " \n\n" . $email . " \n\n" .
          "Subject:" . " \n\n" . $subject . " \n\n" .
          "Message:" . " \t\n\n" . $message;
    $this->email->message($msgBody);

   if($this->email->send()){

   $config = array();
   $config['center'] = 'Australia';
   $config['zoom'] = '5';

   $this->googlemaps->initialize($config);

   $data_map['map'] = $this->googlemaps->create_map();

   $success['flash'] = $this->session->flashdata('success');
   $this->session->set_flashdata('success', 'Message Has Been Submitted Successfully');

   $this->load->view('header', $data_map);
   $this->load->view('contactus');
   $this->load->view('footer');

   }else{

    echo $this->email->print_debugger();

   }


  }

}
}


Messages In This Thread
Need FLASH DATA NEED HELP - by El Forum - 11-01-2013, 08:14 PM
Need FLASH DATA NEED HELP - by El Forum - 11-02-2013, 09:58 AM
Need FLASH DATA NEED HELP - by El Forum - 11-02-2013, 07:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB