• 0

Problems with dynamic pages


Question

Hello,

I ran into new problem, I'm trying to figure this out for last two days, in total of 12 hours and you guys are my last hope.

I've got 4 files that needs to be "connect"

index.php <- contains one switch statement

Here's part of it

$step = (isset($_GET['action'])) ? $step = $_GET['action'] : $step = "1";
switch($step) {
			//index
			case "1":
				include("admin/index.php");
				break;

second file is located in

admin/index.php <- contains navigation links, pure html

Here's part of it

&lt;a href="?action=1"&gt;Home&lt;/a&gt;&lt;br /&gt;

This is all working fine with no problems, which starts here

I've got script for categories and subcategories which contains links and buttons

&lt;input type="button" name="Button" value="Remove" onClick="location='?action=delete&amp;id=&lt;?=$c["id"]?&gt;'"&gt;
[&lt;a href="?action=delete&amp;id=&lt;?=$c["id"]?&gt;"&gt;Remove&lt;/a&gt;

In first index.php located outside /admin/ folder, where switch statement is I have the following code

case "delete":
			require("admin/categories.class.php");
				$categories-&gt;delete($_GET["id"]);
					echo '&lt;script&gt;alert("Removed!");
					 location="admin/class_categories_test.php";	
					&lt;/script&gt;';
			break;

and when I click on "Remove" I get the following error

Fatal error: Call to a member function delete() on a non-object in index.php

As you may notice all functions are stored in admin/categories.class.php that's why I've require("admin/categories.class.php"); in switch statement.

Regards

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.