I have this following code in my Controller
:
public function SetImageAndColor($client_id) {
if(isset($_GET['color']) AND isset($_GET['image'])) {
$dados['click2call'] [$client_id] ['image'] = $this->input->get('image');
$dados['click2call'] [$client_id] ['color'] = $this->input->get('color');
$this->session->set_userdata('click2call', $dados);
}
}
The goal is to save the parameters passed by the url (color and image) in the session. Correct?
After that, I need to check inside the View
, if these parameters exist, in order to call them (because they will enter the site customization). But I've tried it anyway (ex: if(isset($_GET['color']))
).
And always returns that these values do not exist, even with them being passed in the url.
This is the code for my View
:
<header data-color="<?php echo $client->click2call_color; ?>">
<h1>
<?php if($client->click2call_image != ''): ?>
<img src="<?php echo $client->click2call_image; ?>" alt="<?php echo $client->name; ?>"/>
<?php else: ?>
<?php echo lang('click2call_title'); ?></h1>
<?php endif; ?>
</header>
In case the values passed by parameter would replace $client->click2call_color
and $client->click2call_image
which are the default.
Is there something wrong with the code?
If not, how could you do this verification?