CodeIgniter Forums

Full Version: Issues with code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I would like to use this code for profile within my code but I get errors of undefinfed variables. Here is the code:

 <div class="avatar">

                            <img alt="<?php print $this->session->userdata('user_name'); ?>" src="<?php print HTTP_IMAGES_PATH; ?>user-default.jpg">
                        </div>
                    </div>
                    <div class="card-body info">
                        <div class="title">
                            <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>
                        </div>
                        <div class="desc"> <a target="_blank" href="<?php print site_url(); ?>"><?php PRINT APPLICATION_NAME; ?></a></div>        
                        <div class="desc"><?php print $userInfo['email']; ?>, <?php print $userInfo['contact_no']; ?></div>      
                        <div class="desc"><?php print $userInfo['address']; ?></div>               

I get errors about the php but dont want to delete them because I feel its important. How do I edit the php inserts so they fit my code?

Heart Heart ,
Mekaboo
What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.
HTTP_IMAGES_PATH
APPLICATION_NAME

Those are variables used in Compass app.

If you want to use those names then you would need to create them using DEFINE.
Then set them to the correct folders etc;
(06-11-2019, 11:56 PM)Wouter60 Wrote: [ -> ]What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line: 

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..
(06-12-2019, 04:40 AM)InsiteFX Wrote: [ -> ]HTTP_IMAGES_PATH
APPLICATION_NAME

Those are variables used in Compass app.

If you want to use those names then you would need to create them using DEFINE.
Then set them to the correct folders etc;

This helps alot with one of the issues I was facing, thank so very much Heart
(06-12-2019, 10:47 AM)Mekaboo Wrote: [ -> ]
(06-11-2019, 11:56 PM)Wouter60 Wrote: [ -> ]What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line:

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..

Can you do this?
PHP Code:
<?php 
var_dump
($userInfo);
?>

Is the error also on this line? If not, what is the content of the variable? Maybe the index 'full_name' is not set. If the error is there, define the variable $userInfo
(06-13-2019, 07:20 AM)jfri Wrote: [ -> ]
(06-12-2019, 10:47 AM)Mekaboo Wrote: [ -> ]
(06-11-2019, 11:56 PM)Wouter60 Wrote: [ -> ]What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line:

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..

Can you do this?
PHP Code:
<?php 
var_dump
($userInfo);
?>

Is the error also on this line? If not, what is the content of the variable? Maybe the index 'full_name' is not set. If the error is there, define the variable $userInfo

That's where the error is. I'm going to try your suggestion and see if it works Heart
Also show the code were your getting $userInfo from.
Thank you all so very much! After some going back and forth I took that code out and decided to try out using Bootstrap Profile cards. Simple and easier to integrate. Thanks again Heart