HI people,
After abit of help with a website i need to create for assignment, not very good on php but getting there, any help would be welcome.
One of my tasks is that a user who logs in can swicth database from MySQL to SQLite, here is my code, just wondering where im going wrong as getting the following error
Fatal error: Call to a member function getProperty() on a non-object in C:\xampp\htdocs\Brookxml\switchdb.php on line 32
Here is the code i currently have for that page -
<?php
// Start login Session
session_start();
?>
<?php
require ('includes/header.php');
?>
<?php
$page_title = 'Change Database';
?>
<strong><h1>Welcome to BrookXML</h1></strong>
<br />
<h2><?php echo "$page_title"?></h2>
<form action="" method="post" value="change">
<p>Please select which Database you would like to use:</p>
<p>MySQL:<input type="radio" name="dbtype" value="MySQL" /></p>
<p>SQLite:<input type="radio" name="dbtype" value="SQLite" /></p>
<p><input type="submit" name="change" value="Change DB" /></p>
</form>
<?php
//code for switching
if (ISSET($_POST[change])){
$session->setProperty('dbType',$_POST[radio]);//change the database type to that selected
}
else{//if change was not selected, get the dbType from sessions
$db = $session->getProperty('dbType');//retrieve the database type
if ($db == ""){//if no DB has been selected yet, assume MySQL and store in sessions
$db = "mysql";
$session->setProperty('dbType',$db);
return "";
}
}
?>
<?php
require ('includes/footer.html');
?>