ETAN
ETAN

Reputation: 3182

codeigniter email variable unable to be displayed

I have been trying to solve a simple bug for the past few hours but failed.

I am not sure why but a variable containing an email address when stored into session userdata could not be displayed, when var_dump(), it return bool(false). The problem is when i var_dump($this->session->all_userdata()); , all the info is there intact including the email address. Only when I var_dump($this->session->userdata('emailadd')); it returns bool(false).

Here is my code: Inside my summary controller

$data = array(
     'case' => $case,
     'cusname'=> $this->input->post('cusname'),
     'emailadd '=> $this->input->post('emailadd'),
     'contact'=> $this->input->post('contact')
);
$this->session->set_userdata($data);
redirect('summary/view');

So summary/view controller loads up a view-v.php view file. The view-v.php view file displays out all the data stored in the session.

<html>
<head><title>View</title>
<body>
Name:<?php echo $this->session->userdata('cusname'); ?>
Email:<?php echo $this->session->userdata('emailadd'); ?>
Case:<?php echo $this->session->userdata('case'); ?>
Contact:<?php echo $this->session->userdata('contact'); ?>
</body>

</html>

Everything else displayed normally except email address.

I am not sure why, according to logic it should all work fine. P/S Session library is set to autoload in config

Upvotes: 0

Views: 76

Answers (1)

Paul
Paul

Reputation: 785

You have left space after emailadd

'emailadd '=> $this->input->post('emailadd'),
         ^^
        space

Upvotes: 1

Related Questions