Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

must be losin it..

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

must be losin it..

Postby mako1200 » Tue Oct 08, 2002 12:15 am

OK....I hope I'm not going crazy...

ok...I'm trying to write a php page that involves passing parameters to itself within the URL (ex: "this.php?that=2"). Now, I've written a bunch of programs before doing this, and I remember them working, but now, it's not. So I wrote a quick test...

<html>
<body>
<?php
global $this;
print "this equals: $this<BR>";
$this = 1;
print "this equals: $this<BR><BR><BR>";
?>
<a href="test.php?this=2">test</a>
</body>
</html>

Now, when I click on "test", it shouldn't it display

this equals: 2
this equals: 1

?? Cuz it's not....the first "this equals" turns up empty. I'm going crazy....but I think I'm missing something really stoopid here....so please save me a bullet to the head.

Thanks!
mako1200
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Oct 08, 2002 12:06 am

Postby DoppyNL » Tue Oct 08, 2002 1:38 am

Did you switch hosts of did some configuration options change??

check this post:
http://www.php-forum.com/p/viewtopic.php?t=318

I think that's you're problem

Greetz Daan
DoppyNL
 

Postby Xerpher » Tue Oct 08, 2002 7:32 am

About the "global $this;", I know that you need touse global inside something like a function, but when else is it used? because that codes' global is certainly not in a function.
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby DoppyNL » Tue Oct 08, 2002 9:33 am

read the post again, you probably have to use
Code: Select all
$_GET['this']


Greetz Daan
DoppyNL
 

Thanks..

Postby mako1200 » Tue Oct 08, 2002 1:07 pm

I figured it out guys...took some digging....but you pointed me into the right direction!

Thanks! :lol:
mako1200
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Oct 08, 2002 12:06 am

Postby DoppyNL » Tue Oct 08, 2002 1:26 pm

Xerpher wrote:About the "global $this;", I know that you need touse global inside something like a function, but when else is it used? because that codes' global is certainly not in a function.

I read this posta bit more carefull this time, and I must agree that I don't see any use for the "THIS LINE":
Code: Select all
<html>
<body>
<?php
global $this;  //-- THIS LINE
print "this equals: $this<BR>";
$this = 1;
print "this equals: $this<BR><BR><BR>";
?>
<a href="test.php?this=2">test</a>

It doesn't do any harm though, so leaving it there is no problem, it simply does nothing (or i'm wrong :))

Greetz Daan
DoppyNL
 


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 10 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron