dynamic title,meta keywords and description..
manually i created one page in that i add some title,keywords and descriptions based on category(i.e like home,about us,contact us etc)in backend, and i have some pages like home.php,aboutus.php etc in front end. so if i click home(home.php) that title should display which i entered for category home same like i have to display in every page based on category. how to do
index.php
if(isset($_POST['submit']))
{
$catagory = $_POST['catagory'];
$title = trim(ucwords(strtolower(mysql_real_escape_string($_POST['title']))));
$description = mysql_real_escape_string($_POST['description']);
$keywords = mysql_real_escape_string($_POST['keywords']);
$sql = mysql_query("INSERT INTO `seo_title`(Catagory,`title`,`description`,`keywords`) VALUES ('$catagory','$title','$description','$keywords')");
if($sql)
{
echo '<script>alert("Inserted Successfully");
window.location="seo_title.php";</script>';
}
}
my input form look like:
<form name="fname" method="post">
<select name="catagory" id="catagory">
<option value='' selected="selected">... Select ...</option>
<?php
include("db.php");
$query = "SELECT `id`, `titles` FROM `seo_footer_title` ";
$result = mysql_query($query);
//echo mysql_error();
while($rows = mysql_fetch_array($result))
{
$selected = "";
$categoryId = $rows['id'];
$categoryName = $rows['titles'];
if($catid == $categoryId)
{
$selected = "selected";
}
?>
<option value="<?php echo $categoryId; ?>" <?php echo $selected; ?> ><?php echo $categoryName; ?></option>
<?php } ?>
</select>
Title: <input type="text" name="title">
Description: <textarea name="description" cols="20" rows="10">