Code not responding accordingly to the parameters passed via the browser
<p>I put the following code in the browser <code>?phase=1&amp;step=0&amp;fot=false</code> and I get a black page.
with the PHP error </p>

<blockquote>
  <p>Undefined variable: fOT in C:\Program Files
  (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 219</p>
</blockquote>

<p>This is the <code>$this-&gt;createTablePages ($fOT);</code> line. If I change it to <code>$this-&gt;createTablePages ($this-&gt;fOT)</code> I get the following error </p>

<blockquote>
  <p>Undefined property: phase2::$fOT in C:\Program Files
  (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 219</p>
</blockquote>

<p>I know that <code>$this-&gt;IDB3 = $this-&gt;handleDatabase()-&gt;$IDB3;</code> in the __constructor is right. How do I do that?</p>

<pre><code>class phase2 {
        function __construct () {

        $dbFile = 'dbconfig.php';
        $this-&gt;dbFile = $dbFile;
        include_once ("$this-&gt;dbFile"); 


        $step = $_GET["step"];

        $username = $DB_USER;
        $password = $DB_PASS;
        $server = $DB_SERVER;
        $dbName = $DB_NAME;

        $this-&gt;step = $step;
        $this-&gt;dbFile = $dbFile;
        $this-&gt;username = $username;
        $this-&gt;password = $password;
        $this-&gt;server = $server;
        $this-&gt;dbName = $dbName;

        $db = new PDO ('mysql:host=' .$server.';dbname='.$this-&gt;dbName,$this-&gt;username,$this-&gt;password);

        $this-&gt;db = $db;

        if (empty ($_GET['fot']) ) { 
        $fOT = 'false'; 
        } elseif ($_GET['true']) { $fOT = 'true'; }

        $this-&gt;IDB = $this-&gt;handleDatabase()-&gt;$IDB;
        $this-&gt;IDB2 = $this-&gt;handleDatabase()-&gt;$IDB2;
        $this-&gt;IDB3 = $this-&gt;handleDatabase()-&gt;$IDB3;
        }



public function handleDatabase (){
// Prepare SQL Statements
    $IDB = $this-&gt;db-&gt;prepare( 
         "CREATE TABLE pages (
          id int(11) NOT NULL auto_increment,
         subject_id int(11) NOT NULL,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          content text NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8");

    $IDB2 = $this-&gt;db-&gt;prepare("
        CREATE TABLE subjects (
          id int(11) NOT NULL auto_increment,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8");

    $IDB3 = $this-&gt;db-&gt;prepare("
        CREATE TABLE users (
          id int(11) NOT NULL auto_increment,
          username varchar(50) NOT NULL,
          hashed_password varchar(40) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8");
}
//Set Option to True or False

function createTablePages ($fOT){

    $r1 = $this-&gt;db-&gt;query('SHOW TABLES LIKE \'page\'');
    if (count($r1-&gt;fetchAll()) &gt; 0 &amp;&amp; $fOT === 'false') {
        echo "The table PAGE exists";

    } elseif ($fOT === 'true') {
        $this-&gt;IDB-&gt;execute;
                $this-&gt;stepFunction (1,false);
    }
}
function createTableSubjects ($fOT){

    $r2 = $this-&gt;db-&gt;query('SHOW TABLES LIKE \'subjects\'');
    if (count($r2-&gt;fetchAll()) &gt; 0  &amp;&amp; $fOT === 'false') {
        echo "The table SUBJECTS exists ";

    } elseif ($fOT === 'true') {

        $this-&gt;IDB2-&gt;execute;
        $this-&gt;stepFunction (2,false);

    }
}

function createTableUsers ($fOT){

    $r3 = $this-&gt;db-&gt;query('SHOW TABLES LIKE \'users\'');   
    if (count($r3-&gt;fetchAll()) &gt; 0  &amp;&amp; $fOT === 'false') {
        echo "The table USERS exists";
    } elseif ($fOT === 'true') {
        $this-&gt;IDB3-&gt;execute;
        echo "Would you like to populate all the tables?";
    }   
}


public function stepFunction ($step, $fOT){

switch ($step) {
    case 0: 
            $this-&gt;createTablePages ($fOT);
            break;
    case 1: 
            $this-&gt;createTableSubjects($fOT);
            break;
    case 2: $this-&gt;createTableUsers ($fOT);
            break;
    }


}

    }
</code></pre>
