Welcome Guest, Not a member yet? Register   Sign In
How to redirect using $this-session-userdata(country_territory)
#12

(This post was last modified: 09-28-2019, 08:05 AM by christaliise.)

(09-28-2019, 03:42 AM)InsiteFX Wrote: You can store the users id in the session then assign it to the view data.

PHP Code:
$data['userID'] = $userID

Then in your view you can create the link like so or use CodeIgniters anchor helper.

PHP Code:
<a href="<?= base_url('adverts/createadvert/'.$userID);?>">Create Advert</a

Thanks InsiteFX. I've created the variable in the Adverts Controller-

PHP Code:
$user_id $this->session->userdata('user_id'); 

And this link in the view-

PHP Code:
<a href="<?php base_url('createadvert/'.$user_id);?>">CreateAdvert</a

My system rejected the above, first by the 2nd "=" so I deleted that, but it is still giving an error.

I realize I need to do a lot more work. Once the advert is created I want it saved by the user_name presumably in the root directory.

However, I first want to get the Layout to work.
Reply


Messages In This Thread
RE: How to redirect using $this-session-userdata(country_territory) - by christaliise - 09-28-2019, 07:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB