Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15613
| From | Matthew Carter <m@ahungry.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: PHP Global Variable Usage - Possible? |
| Date | 2015-07-26 21:42 -0400 |
| Organization | Ahungry (http://ahungry.com) |
| Message-ID | <87k2tmcr65.fsf@ahungry.com> (permalink) |
| References | <MPG.301f35426b8e02f09896ae@news.eternal-september.org> |
MikeCopeland <mrc2323@cox.net> writes: > Almost new to PHP, and I'm wondering if PHP will do something I want > to do. Scenario: > 1. 3 Web pages: index.php; text01.php; and people.php > 2. In index.php I want to establish a default value in a global > variable, and I want to access that variable's value in test01.php > 3. In text01.php I have numerous divs and paragraphs of text. I want > to use the global value to establish a default text color and div > background. I also have anchor links in the code to allow other pages > to link to specific areas of the text data in text01.php > 4. In people.php I have some hrefs that link in text01.php. When > someone clicks on those links in people.php, not only do I want > text01.php rendered, but I want to be able to change the global > variable's value so that the logic in text01.php can change > characteristics of that div code in text01.php. > (Note that I have the fundamentals of the Web site working - as .html > pages - and I haven't yet invested in converting to using php sources. > (I did some php Web development several years ago, but I've discarded > that system and forgotten all of what I did: I'm starting over, and I > never did anything like this current project...) > Is such processing at all possible? If so, please direct me to some > examples of "how to" that I may start from. TIA > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > Variables only persist for the duration of script/program execution. You may want to look into using cookies or sessions (or you could have some persistence via the query string). -- Matthew Carter (m@ahungry.com) http://ahungry.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PHP Global Variable Usage - Possible? MikeCopeland <mrc2323@cox.net> - 2015-07-26 18:20 -0700
Re: PHP Global Variable Usage - Possible? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-26 21:41 -0400
Re: PHP Global Variable Usage - Possible? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-26 21:51 -0400
Re: PHP Global Variable Usage - Possible? Matthew Carter <m@ahungry.com> - 2015-07-26 21:42 -0400
Re: PHP Global Variable Usage - Possible? Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-27 23:00 +0000
Re: PHP Global Variable Usage - Possible? Matthew Carter <m@ahungry.com> - 2015-07-27 20:59 -0400
csiph-web