problems with my php code (in version 4.2.1)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wallenium
Forum Newbie
Posts: 3
Joined: Wed Jul 17, 2002 2:45 pm

problems with my php code (in version 4.2.1)

Post by wallenium »

I had version 4.1.x. there the script worked fine.. now i have the newest php version and it don't really go...

its a code for an homepage, to include the mainsites in the table....
the links to include the files in one of the tablefields (there the case-code is standing..) you had to enter a link like: main.php?title=test

here's the code.. if you've a better working one (ore one how*ll work on 2.1 post it please.. thx

Code: Select all

<?php
            switch($title)
                        &#123;
                        case "main" : include("bodynews.php");break; &#125;   
....
...
...
                                                           ?>
User avatar
haagen
Forum Commoner
Posts: 79
Joined: Thu Jul 11, 2002 3:57 pm
Location: Sweden, Lund

Post by haagen »

Where do you get the title var from? If it is a GET or POST variabel se the sticky notes in this forum.

If not, please explain why and how it's not working.
wallenium
Forum Newbie
Posts: 3
Joined: Wed Jul 17, 2002 2:45 pm

Post by wallenium »

haagen wrote:Where do you get the title var from? If it is a GET or POST variabel se the sticky notes in this forum.

If not, please explain why and how it's not working.
no. its the comlete code.. it workes.. little example:

$title --> main.php?title=main
$test --> main.php?test=main

/€

Code: Select all

<?php if ($&#123;QUERY_STRING&#125;=="about"): ?>
<?php include ("inhalte/bio/about.php")?>
<?php endif; ?>
thats the same.. code
User avatar
haagen
Forum Commoner
Posts: 79
Joined: Thu Jul 11, 2002 3:57 pm
Location: Sweden, Lund

Post by haagen »

Ok. It looks like it is a GET var. Have you tried to echo to contents of $title on to the page? This could show you title have the contents you assume.

I belive that you should fetch the variabel first:

$title = $_GET["title"];

This is the big diffrence between php 4.2 and older version. All this is mentioned in the sticky note. Please read them.
wallenium
Forum Newbie
Posts: 3
Joined: Wed Jul 17, 2002 2:45 pm

Post by wallenium »

haagen wrote:Ok. It looks like it is a GET var. Have you tried to echo to contents of $title on to the page? This could show you title have the contents you assume.

I belive that you should fetch the variabel first:

$title = $_GET["title"];

This is the big diffrence between php 4.2 and older version. All this is mentioned in the sticky note. Please read them.
ok. it worked. thank you very much.. i don't kwow that the new version need it..
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

This is why I have it at the top of the page: http://www.devnetwork.net/forums/viewtopic.php?t=511
Post Reply