Ok Im an aboslute noob and dont even know if my title is on target for what I want to do.
I have a script here that creates categories etc, it's all PHP and something like ZenCart, OScommerce etc but with it I want to know how to turn it around to have SEO friendly URL's.
WhenI enter a category or product Id in the back office it I assume it stores them in the ?databse? so in aassuming that they are stored in there as category1 and product 2 and so forth.
This is the code used to call the category ID to the page.
Code:
if(!empty($_GET[CategoryID]))
{
$query[] = " ItemCategory = '$_GET[CategoryID]' ";
}
Here is the code on the admin page that is used to enter the category ID to the database.
Code:
<?
require_once("../conn.php");
require_once("access.php");
require_once("../includes.php");
require_once("AdminNavigation.php");
if(isset($_POST[s1]))
{
if(!empty($_POST[categoryname]))
{
$q1 = "insert into dd_categories set
CategoryName = '$_POST[categoryname]' ";
$r1 = mysql_query($q1);
if(mysql_error())
{
$error = "<span class=BlackLink>The category name <font color=black>$_POST[categoryname]</font> already exist!</span>";
}
}
else
{
$error = "<span class=BlackLink>Enter the New Category name, please!</span>";
}
}
?>
<br>
<center>
<span class=BlackLink>Add a new category</span>
<br><br>
<form method=post>
<table align=center width=350>
<caption align=center><?=$error?></caption>
<tr>
<td align=right>New Category name:</td>
<td><input type=text name=categoryname size=20></td>
<td><input type=submit name=s1 value="Add"></td>
</tr>
</table>
</form>
<?
$q1 = "select * from dd_categories order by CategoryName";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) > '0')
{
echo "<br>";
echo "<table align=center width=300 cellspacing=0><caption align=center><span class=BlackLink>Categories List:</span></caption>\n<tr class=TableHead>\n\t<td>Categories</td>\n\t<td align=center>Action</td>\n</tr>\n\n";
$col = "white";
while($a1 = mysql_fetch_array($r1))
{
if($col == "white")
{
$col = "dddddd";
}
else
{
$col = "white";
}
echo "<tr bgcolor=$col>\n\t<td align=left>$a1[CategoryName]</td>\n\t<td width=100 align=center><a class=GreenLink href=\"EditCategory.php?CategoryID=$a1[CategoryID]\">edit</a> | <a class=BlackLink href=\"DeleteCategory.php?CategoryID=$a1[CategoryID]\" onclick=\"return cdel('$a1[CategoryName] category');\">delete</a></td>\n</tr>\n\n";
}
echo "</table>";
}
?>
My ultimate goal is to get the url of category and on the product pages to be the name that I give the product or category.
I chose this question because ultimately it is going to help me understand the admin panel, moving stuff to a databse and linking together code.
I look forward to a response.
Thank you everyone.