Antraxek Posted January 14, 2011 Share Posted January 14, 2011 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 <a href="?action=1">Home</a><br /> This is all working fine with no problems, which starts here I've got script for categories and subcategories which contains links and buttons <input type="button" name="Button" value="Remove" onClick="location='?action=delete&id=<?=$c["id"]?>'"> [<a href="?action=delete&id=<?=$c["id"]?>">Remove</a> 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->delete($_GET["id"]); echo '<script>alert("Removed!"); location="admin/class_categories_test.php"; </script>'; 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 More sharing options...
0 Joak1m Posted January 15, 2011 Share Posted January 15, 2011 And what happens when you just print out the on the index php page? Do you even bypass the id? Link to comment Share on other sites More sharing options...
Question
Antraxek
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
This is all working fine with no problems, which starts here
I've got script for categories and subcategories which contains links and buttons
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->delete($_GET["id"]); echo '<script>alert("Removed!"); location="admin/class_categories_test.php"; </script>'; break;and when I click on "Remove" I get the following error
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