Reputation: 15
i have a problem : when click register in my form it is redirect me to the login page but they do not show me this message .
"Thank you , you have been registered"
this is a part of my login page "view"
<div class="container">
<div class="row">
<div class="col-md-5 center-block-e">
<div class="login-page-header">
<?php echo lang("ctn_304") ?> <?php echo $this->settings->info->site_name ?>
</div>
<div class="login-page">
<?php echo form_open(site_url("login/pro")) ?>
<div class="input-group">
<span class="input-group-addon white-form-bg"><span class="glyphicon glyphicon-user"></span></span>
<input type="text" name="email" class="form-control" placeholder="<?php echo lang("ctn_303") ?>">
</div><br />
<div class="input-group">
<span class="input-group-addon white-form-bg"><span class="glyphicon glyphicon-lock"></span></span>
<input type="password" name="pass" class="form-control" placeholder="<?php echo lang("ctn_180") ?>">
</div>
<p class="decent-margin"><input type="submit" class="btn btn-primary form-control" value="<?php echo lang("ctn_184") ?>"></p>
<p class="decent-margin"><a href="<?php echo site_url("login/forgotpw") ?>"><?php echo lang("ctn_181") ?></a></p>
this is a part of my register page "controller"
if (empty($fail)) {
// Check for any default user groups
$default_groups = $this->user_model->get_default_groups();
foreach($default_groups->result() as $r) {
$this->user_model->add_user_to_group($userid, $r->ID);
}
$this->session->set_flashdata("globalmsg", $success);
redirect(site_url("login"));
}
Upvotes: 1
Views: 203
Reputation: 9717
Note: make sure you have loaded session library
In login view to show msg use this line of code :
<?php echo $this->session->flashdata('globalmsg');?>
Code should be like this (use wherever you want to show):
<div id="container">
<div class="row">
<?php echo $this->session->flashdata('globalmsg');?>
..........
</div>
</div>
Set your flash data in register page "controller" like this :
$this->session->set_flashdata("globalmsg", 'Thank you , you have been registered');
redirect(site_url("login"));
Upvotes: 0
Reputation: 39
you have to add container on login page e.g <div id='globalmsg'></div>
any element where your id should be the which passed to the first parameter passed to the to append your succes message and second parameter is your message
$success = '"Thank you , you have been registered"';
$this->session->set_flashdata("**globalmsg**", $success);
Upvotes: 0