1
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, to be able to call them (because they will enter in the customization of the site) . But I have tried in every way (ex: if(isset($_GET['color']))
).
And it always returns that these values do not exist, even though they are passed in the url.
This is the code of mine 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 this case the values passed by parameter would replace $client->click2call_color
and $client->click2call_image
that are the standard.
There’s something wrong with the code?
If not, how could I make this check?
are you using any framework? what kind of view is this? You can also put the view trehco in your question?
– Gê Bender
Codeigniter usage. I added the snippet as requested. @Gebender
– GWER