Forum Moderators: coopster

Message Too Old, No Replies

PHP not passing variables

         

Evancool

5:57 am on Mar 27, 2004 (gmt 0)

10+ Year Member



I recently upgraded my PHP version to 4.3.4 from 4.1.2. There seems to be a problem when passing variables on a webpage. PHP does not respond to these requests.

For example. index.php has data on the page. index.php?page=2 has different data. The page variable has been declared in index.php. However, since the upgrade, index.php shows the same data regardless whether page is defined or not. I have tried toggling Register Globals on and off and no effect.

This is how page is declared: $page = $_GET['page'];

I have two websites depending on this variable passing. Any suggestions?

jatar_k

6:25 pm on Mar 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Evancool,

Have you tried to see if the value is there?

echo $_GET['page'];

and see if there is anything in it?
Are you getting any errors or is it just nothing happening?

Evancool

4:29 am on Mar 28, 2004 (gmt 0)

10+ Year Member



Thanks for the welcome!

I did the echo command and it shows the variable. There does not seem to be any error, it's just nothing is happening.

When you click on next, the page data does not change even though it says index.php?page=2.

This exact same code worked in the earlier version of PHP, which was 4.1.2. We upgraded to 4.3.4. This script is designed to work with 4.3.2 and above.

The program is Maian Weblog. Under normal circumstances this script works just fine. But since the upgrade the page variable will not work.

If you look at index.php on line 211, the page variable is declared as $page = $_GET['page'];

I have tried turning register globals off and on in the php.ini and no effect.

I am completely stumped as to why this happened. I heard about a bug in PHP 4.2.3 that required certain conditions like session.bug42 or something of that nature. I don't know if it would be relevant but my clients' websites won't work until this problem is solved.

On another note, before the upgrade, we also installed the BlueDragon server for coldfusion. I am not sure if it could be linked to the problem. Any thoughts? Thanks!

[edited by: jatar_k at 4:42 pm (utc) on Mar. 28, 2004]
[edit reason] no personal urls thanks [/edit]

dreamcatcher

9:03 am on Mar 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Evan,

Glad you made it to the forum. I`m just wondering if its because I declared the $_GET variable too late in the index.php file. Try moving:

$page = $_GET['page'];

to before line 97 in the index.php file.

Also, don`t know if it will make any difference, but on line 97 change:

if (!isset($page))

to

if (!empty($page))

David.

Evancool

1:11 am on Mar 29, 2004 (gmt 0)

10+ Year Member



Hey David! Well, I tried moving the line to before 97 and changing isset to empty that did not work.

But, I reverted empty back to isset with page still declared at 97 and it WORKED! Well done!

There is just one more thing though, I hope you still support v1.1 of your weblog.

The demo site you saw is live. and it has another section that depends on your v1.1 weblog which is having the same problem right now. And I cannot find the page declared variable in that index.php.

Go here to see: <snip>

There is 20 pages of news, and it won't go past page 1. The same problem as before. I have several projects going right now so unfortunately I don't have time to upgrade it to v1.2.

Any suggestions on that?

[edited by: jatar_k at 1:13 am (utc) on Mar. 29, 2004]
[edit reason] no personal urls thanks [/edit]

Evancool

1:18 am on Mar 29, 2004 (gmt 0)

10+ Year Member



David, I almost forgot, in the news section, when I try to login to the admin section, it will not go to admin.php. Instead it goes right back to login.php.

Would it be possible to run the install.php again or will that delete every entry in the database?

dreamcatcher

5:08 pm on Mar 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately I no longer have the v1.1 files, so I can`t check. v1.2 was re-written with a completely different coding structure. You can`t post URLS here, so you`ll need to e-mail me again with the files in question and the links to your site.

:)

Evancool

6:42 am on Mar 30, 2004 (gmt 0)

10+ Year Member



Yikes I should have read the rules more closely. Anyway I did send you an email. A guy at work said I should reinstall PHP but I'm not exactly comfortable doing that.

The howtos' that I read seemed a little complicated. Which is the easy way to Install PHP on redhat? RPM? Straight compile, apt-get?

I saw that 4.3.5 is out. And maybe that could fix this problem?