I'm trying to make a button so when the users -> user_id == the same as the products-> user_id echo a button but its not working. So only when the product has the same user_id as the session user_id , I want to echo a button with a link to another page but its not working.
This is what I tried to do:
<div class="cadeau_bewerken">
<?php if ( $_SESSION['user_id'] == $product["user_id"]): ?>
<a class="btn btn-primary" href="<?php echo base_url() ?>/KdGwController/details_bewerken/<?php echo $product->product_id; ?>"> Cadeau bewerken </a>
<?php endif; ?>
</div>
I do see a button but its not a link and not working and I'm getting this error:
A PHP ERROR WAS ENCOUNTERED Severity: Notice Message: Trying to get property of non-object Filename: views/details.php Line number: 54
This is line number 54 in details.php:
<a class="btn btn-primary" href="<?php echo base_url() ?>/KdGwController/details_bewerken/<?php echo $product->product_id; ?>"> Cadeau bewerken </a>
And yes I defined $product because on the same page I'm able to echo the name for example like this:
<?php echo $product['product_name']; ?>
Aucun commentaire:
Enregistrer un commentaire