Page 1 of 1

problems with my php code (in version 4.2.1)

Posted: Wed Jul 17, 2002 2:45 pm
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;   
....
...
...
                                                           ?>

Posted: Wed Jul 17, 2002 2:59 pm
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.

Posted: Wed Jul 17, 2002 3:06 pm
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

Posted: Wed Jul 17, 2002 3:13 pm
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.

Posted: Wed Jul 17, 2002 3:31 pm
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..

Posted: Wed Jul 17, 2002 3:36 pm
by jason
This is why I have it at the top of the page: http://www.devnetwork.net/forums/viewtopic.php?t=511