473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can't output a variable to HTML

I have this code on a page:

<p class="appTitle">
<?php echo "$appTitle"; ?>
</p>

But the resulting HTML is:

<p class="appTitle">
</p>

$appTitle is a global variable which I've declared at the top of the
page in a require_once file like this:

$_GLOBALS['appTitle'] = "My App Title";

According to my debugger, $appTitle is defined with the correct value
when execution reaches that point.

I've also tried,

<?= "$appTitle" ?>

However this work fine:

<?php
$appTitle = "My app";
?>
<?= $appTitle ?>

I have a feeling the answer is something totally obvious, and I'm just
not seeing it.

Phester

Jul 17 '05 #1
2 2025

On 20-Sep-2003, Phester
<el**********@thesearentthedroidsyourelookingfor.y ahoo.com> wrote:
I have this code on a page:

<p class="appTitle">
<?php echo "$appTitle"; ?>
</p>

But the resulting HTML is:

<p class="appTitle">
</p>

$appTitle is a global variable which I've declared at the top of the
page in a require_once file like this:

$_GLOBALS['appTitle'] = "My App Title";

According to my debugger, $appTitle is defined with the correct value
when execution reaches that point.

I've also tried,

<?= "$appTitle" ?>

However this work fine:

<?php
$appTitle = "My app";
?>
<?= $appTitle ?>

I have a feeling the answer is something totally obvious, and I'm just
not seeing it.


try adding

global $appTitle;

--
Tom Thackrey
www.creative-light.com
Jul 17 '05 #2
Tom Thackrey wrote:
On 20-Sep-2003, Phester
<el**********@thesearentthedroidsyourelookingfor.y ahoo.com> wrote:

I have this code on a page:

<p class="appTitle">
<?php echo "$appTitle"; ?>
</p>

But the resulting HTML is:

<p class="appTitle">
</p>

$appTitle is a global variable which I've declared at the top of the
page in a require_once file like this:

$_GLOBALS['appTitle'] = "My App Title";

According to my debugger, $appTitle is defined with the correct value
when execution reaches that point.

I've also tried,

<?= "$appTitle" ?>

However this work fine:

<?php
$appTitle = "My app";
?>
<?= $appTitle ?>

I have a feeling the answer is something totally obvious, and I'm just
not seeing it.

try adding

global $appTitle;


OK thanks. That solved it.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PWR | last post by:
Platform: Windows Python: 2.3 Python Skill: Reading, Learning, but still newbie. Mission: My mission is writing a script that is triggered from my mail server. The script will execute and...
7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
5
by: Marcel Akkerman | last post by:
Hi, Does anyone have a clue how to reduce the number of nodes using XSLT? When outputing all nodes in order I could just use <xsl:for-each select="name"> But what if I, besides sorting and...
0
by: thomas | last post by:
I was wandering if theres a way to make a .xsl page output 20 results per page. My page transforms an .xml file but as its a large file, it outputs hundreds of results on the same page. heres my...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
4
by: Ben Holness | last post by:
Hi all, I have a function, say: function printTable($Variables) { ?> <table> <tr><td>Your name is</td></tr> <tr><td>
3
by: bloc | last post by:
I am programming an interactive CV using xml, xslt and java script. The page consists of a header which contains links to various 'sections' on the xml cv, a left and right menu, and a central...
15
by: Evil Otto | last post by:
My page loads, and calls an init() function that returns content to a div on the page, as well as setting a $_SESSION variable. The content it returns includes a link that calls the same variable,...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
0
by: jebbyleezer | last post by:
Hello, I have source code that builds correctly, however, after the program terminates the output file produced is empty. Here is my source code: import java.io.*; import java.util.Scanner;...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.