Jump to content

[SOLVED] Body ID not being passed


devxtec

Recommended Posts

I have a PHP Script which uses a body id to to identify the data that needs to be loaded on the page, The body id is passed through the URL of the web page ( http://www.example.com/index.php?bod=22 ) This bod value is then picked up by the PHP script and used to pull the correct data from the MySQL database.

 

When I moved the website from a server running MySQL 4 & PHP 4 to a server running MySQL 5 & PHP 5 it broke the site. To verify that it was the bod ID not being passed I had the site echo out the current bod id when switching between pages. Each time it would echo out a blank value which the site then interprets to load up the default page content.

 

My question is would the bod id not being passed be an apache problem or a PHP issue?

 

Here is the index.php code which checks for the bod id.

 

<?php

require_once("DSI_website.php");

$site = new DSISite( "www.example.com", "localhost" );

 

if( isset($bod) )

        {

        $site->Generate_Page($bod);

        }

else

        {

        $site->Generate_Page();

        }

 

echo $site->page;

?>

 

And here is the Generate Page function.

 

Function Generate_Page( $page_index="default" ) {

                $this->page = "";

                $this->page .= $this->Start_Page();

                $this->page .= $this->Output_Header();

                $this->page .= $this->Output_Links();

                $this->page .= "<div id=\"sub\">\n";

                $this->page .= $this->Output_Ads();

                $this->page .= $this->Output_Body( $page_index );

                $this->page .= "</div>\n";

                $this->page .= $this->Output_Footer();

                $this->page .= $this->Finish_Page();

        }

 

Any help is greatly appreciated.  ;D

Link to comment
Share on other sites

Thanks for the help. Once you both said to use $_GET['bod'] it was like a light bulb coming on in my head. I'm shocked I didn't realize that. Anyway I put that in place and had it set to the value of $bod and it's working now. Again thanks everyone!

Link to comment
Share on other sites

And the sad thing about this is register_globals were turned off in php 6 years ago in 2002 and no code should have been written after that point in time that relied on them being on. There are going to be a lot of unhappy people and a lot of work fixing code when php6 comes out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.