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

  • SEARCH
  • Home
  • 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 9119289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:21:37+00:00 2026-06-17T05:21:37+00:00

I have a PHP if/else statement. This is the code I’m trying to echo

  • 0

I have a PHP if/else statement. This is the code I’m trying to echo under an else condition.

<?php $locked = ForumData::is_topic_locked($post->topic_id);
            if ($locked->topic_locked == 1) {echo '<td align="right"><font color="#FF0000">Topic Locked</font><td>';}
            else { 
            echo '<td align="left"><a href="'.url('Forum/create_new_post?topic_id='.$post->topic_id.'&forum_id='.$post->forum_id.'').'"><img src="<?php echo SITE_URL?>/lib/skins/flyeuro/images/forums/t_reply.gif"/></a></td>'; }
            ?>

The bit I’m interested to echo is this.

<img src="<?php echo SITE_URL?>

If I try this… ‘echo SITE_URL’

Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';'

But this doesn’t parse the image, and if I try parsing anything else, it’s giving me parsing errors, which I can’t fix?

How can I therefore produce an echo inside another echo?

  • 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-17T05:21:39+00:00Added an answer on June 17, 2026 at 5:21 am

    why did you open a <?php tag again, you are already in echo line?

    echo '<td align="left"><a href="'.url('Forum/create_new_post?topic_id='.$post->topic_id.'&forum_id='.$post->forum_id.'').'"><img src="'.SITE_URL.'/lib/skins/flyeuro/images/forums/t_reply.gif"/></a></td>';
    

    and what is SITE_URL? Is that a variable, did you forget to put $?


    echo prints out the string that you gave as parameter,

    echo "foo";
    

    As @hakre mentioned about it, . is used to concatenate strings.

    $var = "foo"."bar";  //foobar
    

    So you can use it in echo line,

    $var = "foo"."bar";  //foobar
    echo "foo "."bar ".$var // foo bar foobar
    

    And It’s not important weather variable defined as a string. It would be a constant variable.

    define('SITE_URL', 'localhost:8080/phpvms'); 
    echo "my website URL is ".SITE_URL; //my website URL is localhost:8080/phpvms
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with this code: <?php echo <meta http-equiv='refresh' content='3;search_enroll.php?&id='.$id />; ?>
I'm executing a PHP if/else statement. However, I want the code to do something
I have some php code with a prepared statement. It is called via Ajax
This is the page that uses this code. I have a php page which
I have this code : PHP : [CONNECT TO DATABASE OR DIE ( THIS
I have this code: var myRSS =[]; function rssReader() { $.getJSON('bbc.php', function(data){ console.log(data); $.each(data[0].channel.item,
I have this code: <div id=menu> <ul> <li><span id=menulabel>Your Languages</span></li> <?php $hotClass = '';
I need help in getting this if else statement working. I have the HTML
I have a PHP file that contains a lot of if and else statements
I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php

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.