Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-13-2006, 06:22 PM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Credits: 0
Rep Power: 11
dirkfirst is on a distinguished road
Default Howto use global variables

How do I use global variables such as $_POST????

Here is an example:

PHP Code:
$variable "some text";

function 
myfunc() {
   print 
$variable// Does not work

__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-13-2006, 10:42 PM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,237
Last Blog:
Passwords
Credits: 877
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John Send a message via MSN to John
Default

PHP Code:
$variable "some text";

function 
myfunc() {
   global 
$variable;
   print 
$variable// Does not work

that sould do the trick
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-14-2006, 09:03 AM
Chan Chan is offline
Programming Professional
 
Join Date: Jun 2006
Posts: 204
Credits: 1
Rep Power: 10
Chan is on a distinguished road
Default

I was having the same problem and was about to post a topic.
That works.

Thank you Sidewinder

Last edited by Chan; 07-15-2006 at 12:20 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-15-2006, 01:49 PM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Credits: 0
Rep Power: 11
dirkfirst is on a distinguished road
Default

Thanks, stupid thing is I knew that already......
__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-15-2006, 02:19 PM
bernkly's Avatar   
bernkly bernkly is offline
Newbie
 
Join Date: Jul 2006
Posts: 15
Credits: 0
Rep Power: 9
bernkly is on a distinguished road
Default

Global variables. Just declare it outside of a local method. This is applied for other computer languages too.

But it's not a programming wise in such way.
__________________
Timemsg - Send self destruct message.

Last edited by bernkly; 07-15-2006 at 02:26 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Global warming target7 The Lounge 7 08-22-2007 11:32 AM
C- Syntax to allocate Global variables to consecutive memory locations techie82 C and C++ 1 04-09-2007 11:42 AM
Global variables (SERVER) Jaan PHP Tutorials 0 03-22-2007 09:43 PM
Variables clookid PHP Tutorials 1 01-11-2007 08:40 PM
Variables Sionofdarkness Java Help 4 08-21-2006 02:32 PM


All times are GMT -5. The time now is 01:53 AM.

Contest Stats

Xav ........ 1322.18
MeTh0Dz|Reb0rn ........ 1053.7
morefood2001 ........ 879.43
John ........ 877.37
marwex89 ........ 869.98
WingedPanther ........ 830.24
Brandon W ........ 735.07
chili5 ........ 309.39
Steve.L ........ 239.84
dcs ........ 216.02

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads