Jump to content

Recommended Posts

I have a problem where when i click on the links to edit/remove/add a category or product, i get an error that reads "The URL is not valid and cannot be loaded." In other words the "link" in the code to go to the editing forms isn't working.  I have stared at the code for hours and cannot figure out why it isn't working.  It looks as if it should, but perhaps it's because some of it may be old php script.  I fairly certain if i can figure out why one form isn't rendering, i can fix the others.

 

Anyway here is a section of code, from categories.php, linking to one of the forms that doesn't show.  I'm fairly certain it's something in this piece of code that causing the "add category form" not to display.  I could be wrong, i'll post the categories.php in it's entirety upon request.

 

function print_add_category_form($id) {

/* print a blank category form so we can add a new category */



global $CFG, $ME;



/* get the name of the parent category */

$qid = db_query("SELECT name AS parent FROM categories WHERE id = $id");

$frm = db_fetch_array($qid);



/* set default values for the reset of the fields */

$frm["parent"] = ov($frm["parent"]);

$frm["newmode"] = "insert";

$frm["name"] = "";

$frm["description"] = "";

$frm["submit_caption"] = "Add Subcategory";



include("templates/category_form.php");	

}

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/128666-problem-with-maintenance-forms/
Share on other sites

Ok that's what i figured.  So i'd assume you need to see the entire "categories.php" code.

 

categories.php

<?php



/******************************************************************************

* MAIN

*****************************************************************************/



include("../application.php");



$DOC_TITLE = "MyMarket Category Management";

include("templates/header.php");



switch (nvl($mode)) {

case "add" :

	print_add_category_form(nvl($id, 0));

	break;



case "edit" :

	print_edit_category_form($id);

	break;



case "del" :

	delete_category($id);

	print_category_list();

	break;



case "insert" :

	insert_subcategory($id, $HTTP_POST_VARS);

	print_category_list();

	break;



case "update" :

	update_category($id, $HTTP_POST_VARS);

	print_category_list();

	break;



default :

	print_category_list();

	break;

}



include("templates/footer.php");



/******************************************************************************

* FUNCTIONS

*****************************************************************************/



function print_add_category_form($id) {

/* print a blank category form so we can add a new category */



global $CFG, $ME;



/* get the name of the parent category */

$qid = db_query("SELECT name AS parent FROM categories WHERE id = $id");

$frm = db_fetch_array($qid);



/* set default values for the reset of the fields */

$frm["parent"] = ov($frm["parent"]);

$frm["newmode"] = "insert";

$frm["name"] = "";

$frm["description"] = "";

$frm["submit_caption"] = "Add Subcategory";



include("templates/category_form.php");	

}



function print_edit_category_form($id) {

/* print a category form so we can add a edit the selected category */



global $CFG, $ME;



/* load up the information for the category */

$qid = db_query("

SELECT name, description, parent_id

FROM categories

WHERE id = $id

");

$frm = db_fetch_array($qid);



/* set values for the form */

$frm["parent"] = "<select name=\"parent_id\">"

	. db_listbox("SELECT id, name FROM categories", $frm["parent_id"])

	. "</select>";

$frm["newmode"] = "update";

$frm["submit_caption"] = "Save Changes";



include("templates/category_form.php");	

}



function delete_category($id) {

/* delete the category specified by $id, and move all the products under

* that category to the immediate parent.  this should be wrapped inside a

* transaction, unfortunately MySQL currently does not support transactions. */



global $CFG, $ME;



/* find the parent of this category */

$qid = db_query("

SELECT cat.name, cat.parent_id, parent.name AS parent

FROM categories cat, categories parent

WHERE parent.id = cat.parent_id

	AND cat.id = $id

");

$cat = db_fetch_object($qid);



/* delete this category */

$qid = db_query("

DELETE FROM categories

WHERE id = $id

");	



/* re-assign all the products in this category to the parent category */

$qid = db_query("

UPDATE products_categories

SET category_id = $cat->parent_id

WHERE category_id = $id

");



/* re-assign all sub categories of this category to the parent category */

$qid = db_query("

UPDATE categories

SET parent_id = $cat->parent_id

WHERE parent_id = $id

");



include("templates/category_deleted.php");

}



function insert_subcategory($id, $frm) {

/* add a new subcategory under the parent $id.  all the fields that we want are

* going to in the variable $frm */



global $CFG, $ME;



$qid = db_query("

INSERT INTO categories (parent_id, name, description)

VALUES ($frm[id], '$frm[name]', '$frm[description]')

");

}



function update_category($id, $frm) {

/* update the category $id with new values.  all the fields that we want are

* going to in the variable $frm */



global $CFG, $ME;



$qid = db_query("

UPDATE categories SET

	 parent_id = '$frm[parent_id]'

	,name = '$frm[name]'

	,description = '$frm[description]'

WHERE id = $id

");

}



function print_category_list() {

/* read all the categories from the database and print them into a table.  we

* will use a template to display the listings to keep this main script clean */



global $CFG, $ME;



$qid = db_query("

SELECT cat.id, cat.name, cat.description, parent.name AS parent

FROM categories cat, categories parent

WHERE parent.id = cat.parent_id

	AND cat.id > 0

");



include("templates/category_list.php");	

}

?>

 

And just in case i'll post one of the forms i am trying to display.

 

category_form.php

<form name="entryform" method="post" action="<?php echo $ME?>">

<input type="hidden" name="mode" value="<?php echo $frm["newmode"]?>">

<input type="hidden" name="id" value="<?php echo pv($id)?>">

<table>

<tr>

<td class=label>Parent:</td>

<td class=normal><?php echo $frm["parent"]?></td>

</tr>

<tr>

<td class=label>Name:</td>

<td><input type="text" name="name" size=25 value="<?php pv($frm["name"]) ?>"></td>

</tr>

<tr valign=top>

<td class=label>Description:</td>

<td><textarea name="description" cols=50 rows=5><?php pv($frm["description"]) ?></textarea></td>

</tr>

<tr>

<td></td>

<td><input type="submit" value="<?php echo $frm["submit_caption"] ?>"></td>

</table>

</form>

 

Hopefully this'll have what you need.  Thanks again for the help:)

i get an error that reads "The URL is not valid and cannot be loaded." In other words the "link" in the code to go to the editing forms isn't working.

 

We need the actual page that contains the links.  We can't help fixing broken links with SQL statements...  Well, maybe you could...

hmm, i'm not sure then.  When i have the browser open to the categories page it shows categories.php at the end of the address bar.

 

The only other thing that suggests being linked to any other pages or forms are these lines in the categories.php file.

include("../application.php");
include("templates/header.php");
include("templates/footer.php");
include("templates/category_form.php");
include("templates/category_form.php");
include("templates/category_deleted.php");
include("templates/category_list.php");

 

I guess for the heck of it i can post all those.

 

First is application.php

<?php session_start();
// error reporting
ini_set('display_errors','On');
error_reporting(E_ALL);

/* define a generic object */
class object {};

/* setup the configuration object */
$CFG = new object;

$CFG->dbhost = "localhost";
$CFG->dbname = "FatalIndustries";
$CFG->dbuser = "FatalIndustries";
$CFG->dbpass = "jfry56gfd";

$CFG->wwwroot     = "/FatalIndustries";
$CFG->dirroot     = "/var/www/html/FatalIndustries";
$CFG->templatedir = "$CFG->dirroot/templates";
$CFG->libdir      = "$CFG->dirroot/lib";
$CFG->imagedir    = "$CFG->wwwroot/images";

/* define database error handling behavior, since we are in development stages
* we will turn on all the debugging messages to help us troubleshoot */
$DB_DEBUG = true;
$DB_DIE_ON_FAIL = true;

/* load up standard libraries */
require("$CFG->libdir/stdlib.php");
require("$CFG->libdir/dblib.php");

/* setup some global variables */
$ME = qualified_me();

/* start up the sessions, to keep things clean and manageable we will just
* use one array called SESSION to store our persistent variables */

session_register("SESSION");

/* connect to the database */
db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
?>

 

header.php

<html>

<head>

<title><?php pv($DOC_TITLE) ?></title>

</head>



<style>

h1      { font-family: Arial, sans-serif; font-size: 14pt; font-weight: bold; color: #006699; }

h2      { font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; }

th      { font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold; text-align: center; }

.h1     { font-family: Arial, sans-serif; font-size: 14pt; font-weight: bold; }

.h2     { font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; }

.label  { font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold; }

.normal { font-family: Arial, sans-serif; font-size: 10pt; }

</style>



<body bgcolor=#ffffff link=#0000ff vlink=#000099 alink=#ff0000>

<div class=h1><?php pv($DOC_TITLE) ?><hr size=1></div>



<table cellspacing=1 cellpadding=5>

<tr valign=top>

<td class=normal bgcolor=#cccccc>

<li> <a href="index.php">Admin Home</a>

<li> <a href="categories.php">Categories</a>

<li> <a href="products.php">Products</a>

</td>

<td width=15 nowrap></td>

<td>

 

footer.php

</td>

</tr>

</table>



<p>

<hr size=1>

<div align=right class=normal>MyMarket "<i>Buy Buy Buy! Why Wait Why Wait!</i>"</div>

</body>

</html>

 

category_form.php

<form name="entryform" method="post" action="<?php echo $ME?>">

<input type="hidden" name="mode" value="<?php echo $frm["newmode"]?>">

<input type="hidden" name="id" value="<?php echo pv($id)?>">

<table>

<tr>

<td class=label>Parent:</td>

<td class=normal><?php echo $frm["parent"]?></td>

</tr>

<tr>

<td class=label>Name:</td>

<td><input type="text" name="name" size=25 value="<?php pv($frm["name"]) ?>"></td>

</tr>

<tr valign=top>

<td class=label>Description:</td>

<td><textarea name="description" cols=50 rows=5><?php pv($frm["description"]) ?></textarea></td>

</tr>

<tr>

<td></td>

<td><input type="submit" value="<?php echo $frm["submit_caption"] ?>"></td>

</table>

</form>

 

category_deleted.php

<p class=normal>

The category <b><?php pv($cat->name) ?></b> has been deleted.  All the products and

sub-categories belonging to <b><?php pv($cat->name) ?></b> have been reassigned to

<b><?php pv($cat->parent) ?></b>.

 

category_list.php

<p class=normal>

<a href="<?php echo $ME?>?mode=add">[+C] Add Category</a>

</p>



<table border=1 cellpadding=3>

<tr>

<th>Action</th>

<th>Category</th>

<th>Parent</th>

<th>Description</th>

</tr>



<?php while ($r = db_fetch_object($qid)) { ?>

<tr>

<td class=normal>

	[ <a title="Add a subcategory under <?php pv($r->name) ?>" href="<?php echo $ME?>?mode=add&id=<?php pv($r->id) ?>">+C</a>

	| <a title="Add a product under <?php pv($r->name) ?>" href="products.php?mode=add&category_id=<?php pv($r->id) ?>">+P</a>

	| <a title="Delete <?php pv($r->name) ?>" href="<?php echo $ME?>?mode=del&id=<?php pv($r->id) ?>">X</a>

	]

</td>

<td class=normal><a title="Edit this category" href="<?php echo $ME?>?mode=edit&id=<?php pv($r->id) ?>"><?php pv($r->name) ?></a></td>

<td class=normal><?php pv($r->parent) ?></td>

<td class=normal><?php pv($r->description) ?></td>

</tr>

<?php } ?>



</table>

 

I hate to post the much code for you all to sift through, but i'm not sure what else to do atm ???

Maybe it's just me, but im still confused. This is what you said in your first post:

 

I have a problem where when i click on the links to edit/remove/add a category or product, i get an error that reads "The URL is not valid and cannot be loaded." In other words the "link" in the code to go to the editing forms isn't working.

 

Where are these links?

Well maybe i'm confused.  I'm very new to php, lol, so bear with me.

 

I'm starting to think there is no actual link, and that's what the problem is.  I've already posted up almost every page of code i have.  And i'm certain the other pages interact in the exact same way these ones do...or are supposed to do.

 

Like i said i get the error "The URL is not valid and cannot be loaded."  I'm guessing because the "URL" doesn't exist so to speak.

 

What the code is supposed to do, in categories.php, is present a list of my database categories.  There is "links," as in text to click on, to add, edit, delete categories and subcategories.  What it's supposed to do is bring up the forms posted previously that allow me to do so.  Instead of bringing up a form it gives me the aforementioned error.

 

Since there is apparently no link that you guys can see, i need to make one to do as mentioned earlier.  If that's the case, then that's what i need help on.

 

I can provide a screenshot of the page, and what happens when i click if need be.

 

Thanks for having such patience 8)  And hopefully we can get this sorted out.

Missed the modify time limit.  Copy/Paste below.

 

EDIT:  Ok i just came across this.

 

<a href="<?php echo $ME?>?mode=add">[+C] Add Category</a>

That i know is a link.  And it's broken.  When i have it open in my browser it says "[+C] Add Category"  and of course when i click it gives that error.

 

All the links that are broken is from the list that is called from the categories.php page.  It calls this list.

 

category_list.php

<p class=normal>

<a href="<?php echo $ME?>?mode=add">[+C] Add Category</a>

</p>



<table border=1 cellpadding=3>

<tr>

<th>Action</th>

<th>Category</th>

<th>Parent</th>

<th>Description</th>

</tr>



<?php while ($r = db_fetch_object($qid)) { ?>

<tr>

<td class=normal>

	[ <a title="Add a subcategory under <?php pv($r->name) ?>" href="<?php echo $ME?>?mode=add&id=<?php pv($r->id) ?>">+C</a>

	| <a title="Add a product under <?php pv($r->name) ?>" href="products.php?mode=add&category_id=<?php pv($r->id) ?>">+P</a>

	| <a title="Delete <?php pv($r->name) ?>" href="<?php echo $ME?>?mode=del&id=<?php pv($r->id) ?>">X</a>

	]

</td>

<td class=normal><a title="Edit this category" href="<?php echo $ME?>?mode=edit&id=<?php pv($r->id) ?>"><?php pv($r->name) ?></a></td>

<td class=normal><?php pv($r->parent) ?></td>

<td class=normal><?php pv($r->description) ?></td>

</tr>

<?php } ?>



</table>

All the links have the exact same error, for each and every category.

Ok, so where is $ME defined? I would imagine there's something wrong there. Mind showing us the generated HTML source of those links? Alternatively, try changing $ME to $_SERVER['PHP_SELF']

 

It's defined in the application.php file.  Using $ME = qualified_me();

 

This is the source generated on the categories.php page.

<html>
<head>
<title>MyMarket Category Management</title>
</head>

<style>
h1      { font-family: Arial, sans-serif; font-size: 14pt; font-weight: bold; color: #006699; }
h2      { font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; }
th      { font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold; text-align: center; }
.h1     { font-family: Arial, sans-serif; font-size: 14pt; font-weight: bold; }
.h2     { font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; }
.label  { font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold; }
.normal { font-family: Arial, sans-serif; font-size: 10pt; }
</style>

<body bgcolor=#ffffff link=#0000ff vlink=#000099 alink=#ff0000>
<div class=h1>MyMarket Category Management<hr size=1></div>

<table cellspacing=1 cellpadding=5>
<tr valign=top>
<td class=normal bgcolor=#cccccc>
<li> <a href="index.php">Admin Home</a>

<li> <a href="categories.php">Categories</a>
<li> <a href="products.php">Products</a>
</td>
<td width=15 nowrap></td>
<td>
<p class=normal>
<a href="http://?mode=add">[+C] Add Category</a>
</p>

<table border=1 cellpadding=3>

<tr>
<th>Action</th>
<th>Category</th>
<th>Parent</th>
<th>Description</th>
</tr>

<tr>
<td class=normal>

	[ <a title="Add a subcategory under Accessories" href="http://?mode=add&id=1">+C</a>
	| <a title="Add a product under Accessories" href="products.php?mode=add&category_id=1">+P</a>
	| <a title="Delete Accessories" href="http://?mode=del&id=1">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=1">Accessories</a></td>

<td class=normal>Top</td>
<td class=normal>List of Accessories</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Apparel" href="http://?mode=add&id=2">+C</a>
	| <a title="Add a product under Apparel" href="products.php?mode=add&category_id=2">+P</a>

	| <a title="Delete Apparel" href="http://?mode=del&id=2">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=2">Apparel</a></td>
<td class=normal>Top</td>
<td class=normal>List of Apparel</td>
</tr>

<tr>
<td class=normal>
	[ <a title="Add a subcategory under Components" href="http://?mode=add&id=3">+C</a>
	| <a title="Add a product under Components" href="products.php?mode=add&category_id=3">+P</a>
	| <a title="Delete Components" href="http://?mode=del&id=3">X</a>
	]
</td>

<td class=normal><a title="Edit this category" href="http://?mode=edit&id=3">Components</a></td>
<td class=normal>Top</td>
<td class=normal>List of Components</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Tires" href="http://?mode=add&id=4">+C</a>

	| <a title="Add a product under Tires" href="products.php?mode=add&category_id=4">+P</a>
	| <a title="Delete Tires" href="http://?mode=del&id=4">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=4">Tires</a></td>
<td class=normal>Top</td>

<td class=normal>List of Tires</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Lubricants & Tools" href="http://?mode=add&id=5">+C</a>
	| <a title="Add a product under Lubricants & Tools" href="products.php?mode=add&category_id=5">+P</a>
	| <a title="Delete Lubricants & Tools" href="http://?mode=del&id=5">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=5">Lubricants & Tools</a></td>
<td class=normal>Top</td>
<td class=normal>List of Lubricants & Tools</td>
</tr>

<tr>
<td class=normal>
	[ <a title="Add a subcategory under Bags" href="http://?mode=add&id=7">+C</a>
	| <a title="Add a product under Bags" href="products.php?mode=add&category_id=7">+P</a>
	| <a title="Delete Bags" href="http://?mode=del&id=7">X</a>
	]
</td>

<td class=normal><a title="Edit this category" href="http://?mode=edit&id=7">Bags</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Bags</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Bicycle Carriers" href="http://?mode=add&id=8">+C</a>

	| <a title="Add a product under Bicycle Carriers" href="products.php?mode=add&category_id=8">+P</a>
	| <a title="Delete Bicycle Carriers" href="http://?mode=del&id=8">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=8">Bicycle Carriers</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Bicycle carriers</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Body Care" href="http://?mode=add&id=9">+C</a>
	| <a title="Add a product under Body Care" href="products.php?mode=add&category_id=9">+P</a>
	| <a title="Delete Body Care" href="http://?mode=del&id=9">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=9">Body Care</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Body Care</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Bottles & Bottle-Cages" href="http://?mode=add&id=10">+C</a>

	| <a title="Add a product under Bottles & Bottle-Cages" href="products.php?mode=add&category_id=10">+P</a>
	| <a title="Delete Bottles & Bottle-Cages" href="http://?mode=del&id=10">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=10">Bottles & Bottle-Cages</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Bottles & Bottle-Cages</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Cycletrainers" href="http://?mode=add&id=11">+C</a>
	| <a title="Add a product under Cycletrainers" href="products.php?mode=add&category_id=11">+P</a>

	| <a title="Delete Cycletrainers" href="http://?mode=del&id=11">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=11">Cycletrainers</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Cycletrainers</td>
</tr>

<tr>
<td class=normal>
	[ <a title="Add a subcategory under Cyclocomputers" href="http://?mode=add&id=12">+C</a>
	| <a title="Add a product under Cyclocomputers" href="products.php?mode=add&category_id=12">+P</a>
	| <a title="Delete Cyclocomputers" href="http://?mode=del&id=12">X</a>
	]
</td>

<td class=normal><a title="Edit this category" href="http://?mode=edit&id=12">Cyclocomputers</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Cyclocomputers</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Displays" href="http://?mode=add&id=13">+C</a>

	| <a title="Add a product under Displays" href="products.php?mode=add&category_id=13">+P</a>
	| <a title="Delete Displays" href="http://?mode=del&id=13">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=13">Displays</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Displays</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Food Supplements" href="http://?mode=add&id=14">+C</a>
	| <a title="Add a product under Food Supplements" href="products.php?mode=add&category_id=14">+P</a>
	| <a title="Delete Food Supplements" href="http://?mode=del&id=14">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=14">Food Supplements</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Food Supplements</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Kickstands" href="http://?mode=add&id=15">+C</a>

	| <a title="Add a product under Kickstands" href="products.php?mode=add&category_id=15">+P</a>
	| <a title="Delete Kickstands" href="http://?mode=del&id=15">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=15">Kickstands</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Kickstands</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Kid Accessories" href="http://?mode=add&id=16">+C</a>
	| <a title="Add a product under Kid Accessories" href="products.php?mode=add&category_id=16">+P</a>
	| <a title="Delete Kid Accessories" href="http://?mode=del&id=16">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=16">Kid Accessories</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Kid Accessories</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Lights" href="http://?mode=add&id=17">+C</a>

	| <a title="Add a product under Lights" href="products.php?mode=add&category_id=17">+P</a>
	| <a title="Delete Lights" href="http://?mode=del&id=17">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=17">Lights</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Lights</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Locks" href="http://?mode=add&id=18">+C</a>
	| <a title="Add a product under Locks" href="products.php?mode=add&category_id=18">+P</a>
	| <a title="Delete Locks" href="http://?mode=del&id=18">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=18">Locks</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Locks</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Luggage-Racks" href="http://?mode=add&id=19">+C</a>

	| <a title="Add a product under Luggage-Racks" href="products.php?mode=add&category_id=19">+P</a>
	| <a title="Delete Luggage-Racks" href="http://?mode=del&id=19">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=19">Luggage-Racks</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Luggage-Racks</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Mudguards" href="http://?mode=add&id=20">+C</a>
	| <a title="Add a product under Mudguards" href="products.php?mode=add&category_id=20">+P</a>
	| <a title="Delete Mudguards" href="http://?mode=del&id=20">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=20">Mudguards</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Mudguards</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Other Accessories" href="http://?mode=add&id=21">+C</a>

	| <a title="Add a product under Other Accessories" href="products.php?mode=add&category_id=21">+P</a>
	| <a title="Delete Other Accessories" href="http://?mode=del&id=21">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=21">Other Accessories</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Other Accessories</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Panniers" href="http://?mode=add&id=22">+C</a>
	| <a title="Add a product under Panniers" href="products.php?mode=add&category_id=22">+P</a>
	| <a title="Delete Panniers" href="http://?mode=del&id=22">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=22">Panniers</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Panniers</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Pumps" href="http://?mode=add&id=23">+C</a>

	| <a title="Add a product under Pumps" href="products.php?mode=add&category_id=23">+P</a>
	| <a title="Delete Pumps" href="http://?mode=del&id=23">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=23">Pumps</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Pumps</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Safety Items" href="http://?mode=add&id=24">+C</a>
	| <a title="Add a product under Safety Items" href="products.php?mode=add&category_id=24">+P</a>
	| <a title="Delete Safety Items" href="http://?mode=del&id=24">X</a>

	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=24">Safety Items</a></td>
<td class=normal>Accessories</td>
<td class=normal>List of Safety Items</td>
</tr>
<tr>
<td class=normal>
	[ <a title="Add a subcategory under Trailers & Strollers" href="http://?mode=add&id=25">+C</a>

	| <a title="Add a product under Trailers & Strollers" href="products.php?mode=add&category_id=25">+P</a>
	| <a title="Delete Trailers & Strollers" href="http://?mode=del&id=25">X</a>
	]
</td>
<td class=normal><a title="Edit this category" href="http://?mode=edit&id=25">Trailers & Strollers</a></td>
<td class=normal>Accessories</td>

<td class=normal>List of Trailers & Strollers</td>
</tr>

</table>
</td>
</tr>
</table>

<p>
<hr size=1>
<div align=right class=normal>MyMarket "<i>Buy Buy Buy! Why Wait Why Wait!</i>"</div>

</body>
</html>

 

And i'll give your code change a try. Thanks.

Ok when i define $ME as $_SERVER['PHP_SELF'] in application.php i get an error.  Unless you meant me to change each and every $ME to $_SERVER['PHP_SELF'] manually.

 

Parse error: syntax error, unexpected T_STRING in /var/www/html/FatalIndustries/application.php on line 38

 

On line 38 the code reads.

session_register("SESSION");

 

Additionally, before i changed the definition, i tried putting the category_form.php url into the browser.  I get another error, surprise surprise lol.

 

Fatal error: Call to undefined function pv() in /var/www/html/FatalIndustries/admin/templates/category_form.php on line 3

 

Line 3 of category_form.php

<input type="hidden" name="id" value="<?php echo pv($id)?>">

 

Maybe that might have something to do with the links being broken?  Is is it just because $id is only defined when you actually click on the link.

Ok, so as suspected, the problem is with $ME. Take a look at the link it's generating:

 

<a href="http://?mode=add">[+C] Add Category</a>

 

There are plenty more like that, and they're all badly formed links. To fix, we'll need to see the code for qualified_me(). Or, switch to using $_SERVER['PHP_SELF']. You are correct that you could make $ME equal to $_SERVER['PHP_SELF']. I would imagine that you got an error because you missed off the semi colon at the end of the line. Basically, you need to find where you define $ME (e.g. $ME = qualified_me();)

and change it to:

 

$ME = $_SERVER['PHP_SELF'];

 

As for the final error, well, it's exactly as it says. The function pv() hasn't been defined. It has nothing to do with the fact $id isn't set (though, you would likely get a different error once you fix this one all the while $id isn't it). Did you forget to include a file with the definition in it?

Ok, one problem down, on to the next >.<

 

The error i got when i made $ME = $_SERVER['PHP_SELF']; before is gone,  I believe i did forget the semi-colon.  So now i don't get any error, no URL blah blah error, nothing.  So that's good.  However, the links still don't work.  The page refreshes but nothing else happens.  Do i have to change anything in addition to $ME = $_SERVER['PHP_SELF']; ?

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.