Hi all,
This is a newbie question but I have been struggling with this for ages. I
have a document with 2 separate <?php sections of code. I would like to
declare some variables in the first section and then read these in the
second but do not seem to be able to do this. Can someone please let me in
on how! :)
Thanks in advance for the help.
Best Regards,
David 3 2332
David Hickman wrote: This is a newbie question but I have been struggling with this for ages. I have a document with 2 separate <?php sections of code. I would like to declare some variables in the first section and then read these in the second but do not seem to be able to do this. Can someone please let me in on how! :)
How about some code?
The following works as expected ...
<?php
echo '<hr />';
$var1 = 'one';
$var2 = 'two';
?>
<table>
<tr><th>HTML</th></tr>
<tr><td>here</td></tr>
</table>
<?php
echo $var1, $var2;
?>
--
"Yes, I'm positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:
David Hickman wrote: Hi all,
This is a newbie question but I have been struggling with this for ages. I have a document with 2 separate <?php sections of code. I would like to declare some variables in the first section and then read these in the second but do not seem to be able to do this. Can someone please let me in on how! :)
Thanks in advance for the help.
Best Regards, David
Can we see a sample? What you're talking about, if I'm reading this
correctly, is this:
<?php $a = 3; ?>
<html>
<head></head>
<body>
<p>Hello everyone. We all know that 2 + 1 = <?php echo $a ?></p>
</body>
</html>
If that's the case, then it should work like a dream. If it's not what
you're talking about, please attach some sample code.
thanks guys, that was what I meant. I must have something wrong in my code.
I'll take a look! :)
Thanks for the help,
David
"Joshua Ghiloni" <jd***@SPAM.ME. AND.DIE.cwru.ed u> wrote in message
news:bd******** **@eeyore.INS.c wru.edu... David Hickman wrote:
Hi all,
This is a newbie question but I have been struggling with this for ages.
I have a document with 2 separate <?php sections of code. I would like to declare some variables in the first section and then read these in the second but do not seem to be able to do this. Can someone please let me
in on how! :)
Thanks in advance for the help.
Best Regards, David
Can we see a sample? What you're talking about, if I'm reading this correctly, is this:
<?php $a = 3; ?> <html> <head></head> <body> <p>Hello everyone. We all know that 2 + 1 = <?php echo $a ?></p> </body> </html>
If that's the case, then it should work like a dream. If it's not what you're talking about, please attach some sample code. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: wenke |
last post by:
Hi,
I am using the following code (see below) from php.net
(http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML
file (encoded in UTF-8). I changed the code slightly so that the cdata
sections will be echoed an not the element names as in the original
example.
In the cdata sections of my XML file I have terms like this:
|
by: Sparko |
last post by:
My Xml is as follows;
<root>
<st id="1">
<rt id="1">
<cr id="1" ca_w="" ca_x="" ca_y="" ca_z="" other attribs>
<ct some attribs>
<te some attribs />
<te some attribs />
|
by: Dan R Brown |
last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to
break up this form into several "tabbed" sections, I break up the form using <div>
tags. Each <div style="display:none"> can be displayed by setting the style attribute
to "display:", or hidden with "display:none". This gives the illusion that the person
filling out the form is switching from page to page...without the overhead of extra
hits on the server,...
|
by: Harlan Messinger |
last post by:
Different pages on a web site can vary in the level of header to which they
descend. One short page may have only <h1>, or <h1> and <h2>. Another,
detailed page, might get all the way down to <h6>.
Maybe the site's page also display common sidebars with their own
hierarchies, such as "In the News" block divided into two or three sections
("Nation", "World", "Metro") of two or three short clips each, each ending
with a link to the full...
|
by: Jose Cuthberto |
last post by:
WRAPPER CODE FOR A SET OF HTML FILES, AND BUTTON BAR LOOKS LIKE BELOW:
|< < <> > >| => <= O' (magnifying glass for small gif text)
I have a number of isolated html files for a 1000 page html document.
The .htm files have associated gifs, anchors, using NAME and HREF attributes.
The htmls are all flat, ie in the same directory but they are named
like chapsec_subsec_page.htm, specifically, a1_1_page_20.htm.
The gifs are in a separate...
| |
by: Rocky Moore |
last post by:
I have a web site called HintsAndTips.com. On this site people post tips
using a very simply webform with a multi line TextBox for inputing the tip
text. This text is encode to HTML so that no tags will remain making the
page safe (I have to convert the linefeeds to <BR>s because the
Server.EncodeHTML does not do that it seems).
The problem is that users can use a special tag when editing the top to
specify an area of the tip that will...
|
by: Sunny |
last post by:
Hi,
I would like in runtime to create some sections of the page, and at the
beginning to put some links to these sections.
Lets say I have to provide some details for every city user will visit.
I fetch the cities from the DB, and details for every city. Now I want
to have a page like this:
|
by: Jon Noring |
last post by:
Out of curiosity, may a CDATA section appear within an attribute
value with datatype CDATA? And if so, how about other attribute
value datatypes which accept the XML markup characters?
To me, the XML specification seems a little ambiguous on this, so
I defer to the XML authorities. Refer to sections 2.4 and 2.7 (it all
hinges on if CDATA attribute values are part of markup or not.)
Thanks.
|
by: Coward 9 |
last post by:
HI,
I saw in an example hello.aspx, there is a <form tagbeing used like
<form runat="server>
I search all html tag references and could NOT find "runat" attributes
for <formtag.
which reference should I use in order to find that?
|
by: Chris F.A. Johnson |
last post by:
On 2008-05-25, mehstg1319 wrote:
....
What if my window is less than 500px high?
Like many people, I find having to scroll sections of a page
annoying, but you can do it with: overflow: auto;
--
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |