Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8964735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:39:21+00:00 2026-06-15T16:39:21+00:00

I’ve been tinkering with the echo statement to make my logout button print in

  • 0

I’ve been tinkering with the echo statement to make my logout button print in my header (when a user is logged in) but I keep either getting errors of this nature:

Parse error: syntax error, unexpected T_ECHO, expecting ‘,’ or ‘;’ in /vagrant/web/Project/application/views/_header.php on line 19 Call Stack: 0.0013 634608 1. {main}() /vagrant/web/Project/index.php:0 0.0123 636728 2. require_once(‘/vagrant/web/Project/system/core/CodeIgniter.php’) /vagrant/web/Project/index.php:202 0.1486 1025392 3. call_user_func_array() /vagrant/web/Project/system/core/CodeIgniter.php:359 0.1486 1025528 4. Fp_controller->index() /vagrant/web/Project/system/core/CodeIgniter.php:0 0.1486 1025976 5. Viewlib->loadview() /vagrant/web/Project/application/controllers/fp_controller.php:12 0.1487 1026192 6. CI_Loader->view() /vagrant/web/Project/application/libraries/Viewlib.php:16 0.1487 1027600 7. CI_Loader->_ci_load() /vagrant/web/Project/system/core/Loader.php:419

or the url will just be completely screwed up (it will literally have “base_url();” instead of the actual base url name that I declared in my config file. Could somebody help me?

Header view

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Final Project Incorporated</title>
    </head>
    <body>
        <h1>Navigation:</h1>

        <ul>
            <li><a href="<?php echo base_url(); ?>fp_controller/index">Home</a></li>
            <li><a href="<?php echo base_url(); ?>fp_controller/directory">Employee Directory</a></li>
            <li><a href="<?php echo base_url(); ?>fp_controller/form">Add Employee Form</a></li>
            <li><a href="<?php echo base_url(); ?>fp_controller/login">Login</a></li>

                <?php 

            if ($this->session->userdata('isLoggedIn')) {
Line 19>>>>              echo "<li>" . "<a href=" . "'" echo base_url();"'" .     "fp_controller/logout" . ">" . "Logout" . "</a>" . "</li>";
            }

            ?>

        </ul>

        <hr />
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:39:22+00:00Added an answer on June 15, 2026 at 4:39 pm

    You can’t put an echo inside a php statement, just concatenate:

    echo "<li>" . "<a href=" . "'".base_url()."'" ."fp_controller/logout" . ">" . "Logout" . "</a>" . "</li>";
    

    You could also use site_url() for this, which takes care of url building:

    echo '<li><a href="'.site_url('fp_controller/logout').'">Logout</a></li>";
    

    Another way of writing it, with short form:

    <?php if ($this->session->userdata('isLoggedIn')) : ?>
       <li><a href="<?php echo site_url('fp_controller/logout');?>">Logout</a></li>
    <?php endif;
    

    This way you reduce any possibile error with escaping quotes etc, just write plain html and use php as templating engine. Personally, I find this way easier to read and less error prone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to construct a data frame in an Rcpp function, but when I
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.